On Tue, 2008-12-02 at 09:31 +0800, Earl Lapus wrote:
> On Mon, Dec 1, 2008 at 10:06 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:
> >>
> >> So, what is the difference between a callback function that is
> >> enclosed on single quotes from that which is not?
> >
> > Nothing really:
> >
> > http://docs.djangoproject.com/en/dev/topics/http/urls/#passing-callable-objects-instead-of-strings
> >
> > Karen
> >
> 
> hi, just a small follow-up.
> 
> if there's no difference then why do I get an error when i put single
> quotes around the admin callback as in,
> (r'^admin/(.*)', 'admin.site.root')
> 
> perhaps admin.site.root is an exception to the rule?

Yes, because admin.site.root isn't a function. It's a method on a class
(which implies a difference in the way things are called).

There's a bit of history going on here: in the early days, all the view
functions had to be strings. We realised it was a bit limiting, because,
amongst other things, it can get quite verbose and it prevented usings
things like class methods or objects with a __call__ function. Thus, the
ability to use proper Python objects there was added a few years ago.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to