James Bennett wrote: > On 7/10/07, Sean Patrick Hogan <[EMAIL PROTECTED]> wrote: >> The "pythonic" way is a new addition to Django if I'm not mistaken. > > Yes, it was added between the 0.95 and 0.96 releases. > >> I personally prefer calling by string because (I'm assuming here) it doesn't >> load the function unless it needs to. > > On the other hand, importing the functions and using them directly > opens up some interesting possibilities -- you can apply decorators > like 'login_required' to them right there in the URLConf, which adds > another layer of configurability that isn't possible when referencing > them as strings. >
apply decorators? do tell... (sorry to turn this into a d-user post...) Ideally I would like to apply it to this whole tree: (r'^eventcal/', include('eventcal.urls')), otherwise, I need to 'cover' all of the ones listed below, including databrowse, which is currently exposed. Carl K # eventcal/urls.py from django.conf.urls.defaults import * from django.contrib import databrowse from eventcal.models import Event info_dict = { 'queryset': Event.objects.all(), } urlpatterns = patterns('eventcal.views', (r'^/?$', 'month_index'), (r'^(?P<year>\d{4})/(?P<month>\d{2})/$', 'month_index'), (r'^(?P<year>\d{4})/$', 'year_index'), (r'^databrowse/(.*)', databrowse.site.root), (r'^test/(?P<object_id>[-\w]+)/$', 'test_event_detail'), ) urlpatterns += patterns('', (r'^detail/(?P<object_id>[-\w]+)/$', 'django.views.generic.list_detail.object_detail', info_dict), ) databrowse.site.register(Event) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---