It's different in the way that the view url won't match and the url
resolving will continue,
where require_GET would raise a django.http.HttpResponseNotAllowed
** I had to change the UrlResolver a bit **
This allow to have same urls which pick the right view base on the
state/values of the request.
Better example:
You post two forms on the same url.
:: urls.py ::
urlpattern += ( url('^$',view_signin), url('^$',view_signup))
signin = lambda r : 'signin' in r.POST
signup = lambda r : 'signup' in r.POST
:: views.py ::
@url_predicates([signin,])
def view_signin(request):
....
@url_predicates([signup,])
def view_signup(request):
....
No matter of the order of the urls regexp in the urls.py the right
view will match.
I can imagine that view predicate can look a bit obscure with having
used them in an other frameworks.
I did some slides which cover this feature in Pyramid.. It should make
the things more clear
http://www.slideshare.net/rachbelaid/pyramid-views-20820325
On May 22, 10:37 pm, Jacob Kaplan-Moss <[email protected]> wrote:
> I'm not sure I understand what you're proposing here. How is this
> different from @require_GET, @require_POST, and friends?
>
> Jacob
>
>
>
>
>
>
>
> On Wed, May 22, 2013 at 11:05 AM, Rach Belaid <[email protected]> wrote:
> > I just did a pull request resulting of my last Django sprints for
> > adding a new feature in Django.
>
> >https://code.djangoproject.com/ticket/20479
>
> > The idea is being able to have more control on the url resolving
> > process.
>
> > I have no merit behind the idea of predicate. Predicate is one of my
> > favorite feature in Pyramid/Pylons to allow more complex and flexible
> > routing.
>
> > I will be curious about feebacks? Do you like this idea of features ?
>
> > The implementation is probably imperfect so don't be too harsh ;) we
> > can always fix the implementation.
>
> > For people unaware about what is a predicate, I advice to check the
> > pyramid doc here:
> >http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/viewcon...
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django developers" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group athttp://groups.google.com/group/django-developers?hl=en.
> > For more options, visithttps://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.