Ilya Semenov wrote:
> === apps/app1/views/__init__.py ===
> @url(r'^index/$')
> def index(request):
>       ...
> 
> @url(r'^news/$')
> def news(request):

While the decorator looks nice it creates in my opinion at least as many 
problems as it solves.

1. You can apply decorators only to custom views, not to generic views. 
And as generic views are commonly used one still should keep a separate 
urls.py for them.

2. One of the best things (again, in my opinion) of urls.py is that it 
shows whole user interface of an app in one place. You loose this 
feature with decorators scattered all over views.

BTW, do you know that you can use function objects instead of their 
names in url definition? So this:

     urlpatterns = patterns(__name__,
         (r'^index/$', 'index'),

becomes just:

     urlpatterns = patterns('',
         (r'^index/$', index),

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