On Fri, 2006-09-22 at 15:18 +0800, limodou wrote:
> On 9/22/06, Ahmad Alhashemi <[EMAIL PROTECTED]> wrote:
> >
> > +1 on the idea.
> >
> > It is starting to make less and less sense to treat a GET and a POST
> > the same way just because they use the same URL.
> >
> > I don't think the implementation is ugly, either. I can't see how it
> > can be made cleaner, except for using constants instead of strings for
> > GET, POST, ..etc. But then again, we are probably getting those as
> > strings from the backends.
> >
> >
> If these things can be done, so if it also can support some
> decorators, for example:
>
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('',
> # Example:
> (r'^django_rest_urls/get/(?P<id>\d+)',
> {'decorator':['utils.user_need_to_admin']},
> 'django_rest_urls.restful.views.get'),
> )
>
> I don'et think carefully about the format, just an idea. So we don't
> need to write the decorator in the view code, just write them in
> urls.py. And I think it will be easier maintained.
-1.
This starts to get really messy. Imagine a whole file full of lines like
that.
The current URL setup configuration encourages code that is simple to
scan through and work out what dispatches to what, by and large. By
wanting to move everything inline, it loses the clarity that makes
Python such a useful language. You aren't even really saving a
significant number of keystrokes here.
Nothing stops you from putting your URL configuration in the same file
as your views if you don't want to have separate files. It's common to
separate them, but not at all necessary. So I don't see any value being
added here and it encourages people to write code that is harder to
read.
Having multiple ways of doing the same thing is not a Python tradition,
when the single way is clear and not onerous. That is one of the reasons
Python has lasted so long.
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---