#903: change login_required
-------------------------------------+--------------------------------------
          Reporter:  Dagur           |         Owner:  adrian                   
          
            Status:  reopened        |     Milestone:                           
          
         Component:  Authentication  |       Version:  SVN                      
          
        Resolution:                  |      Keywords:  decorators 
login_required login_url
             Stage:  Unreviewed      |     Has_patch:  1                        
          
        Needs_docs:  0               |   Needs_tests:  1                        
          
Needs_better_patch:  0               |  
-------------------------------------+--------------------------------------
Changes (by vbmendes):

  * status:  closed => reopened
  * component:  Core framework => Authentication
  * needs_tests:  0 => 1
  * version:  => SVN
  * keywords:  => decorators login_required login_url
  * has_patch:  0 => 1
  * resolution:  fixed =>

Comment:

 I am reopening this ticket becouse I don't see a reason for not adding
 login_url parameter for login_required decorator. It is already callable,
 and already takes parameters (redirect_field_name). So, why not adding the
 login_url parameter?

 I also realised that permission_required decorator doesn't accepts
 redirect_field_name. So, why not make a pattern for the acceptable
 parameters for the auth decorators?

 I wrote a patch to create this pattern. Now all three decorators accepts
 login_url and redirect_field_name. permission_required requires an extra
 parameter (perm) and user_passes_test requires test_func.

 In login_required, the parameters order is different becouse of backwards
 compatibility, since you can do this expecting 'redirect_to' to be the
 redirect_field_name:

 @login_required('redirect_to')
 def my_view(request):
     # ...

-- 
Ticket URL: <http://code.djangoproject.com/ticket/903#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to