On Thu, 2008-01-03 at 16:51 -0800, LorenDavie wrote: > Hi Lloyd, > > In your urls.py file, you want to specify the view as a string - > you're currently missing the quotes around it. It should look like > this: > > urlpatterns = patterns(", > (r'^time/$' , 'current_datetime'), # <-- quotes added! > ) > > The (not particularly helpful) message you're getting is django > attempting a string operation (an rindex - right index) on an actual > python function object instead of a string. I'm guessing that you > imported the view into the urls.py file, which is how you even got > that far.
Okay ,this is twice now that somebody's written this. It isn't true! For quite a while Django has allowed function references as the second argument in a URL tuple. It makes for slightly safer code (typos get caught early, for example) and shorter code, too. As Fredrik Lundh pointed out, the "callable has no attribute rindex" error points to the original poster using 0.95, rather than 0.96. There was a problem with callables not involving periods in their specification (ticket #2875) and it was fixed in r4047 on November 7, 2006 -- a few months after 0.95 was released. Regards, Malcolm -- What if there were no hypothetical questions? http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---