#10525: staff_member_required doesn't work for FormWizard / __call__()
-----------------------------------------------+----------------------------
 Reporter:  Alpha1650                          |       Owner:  nobody    
   Status:  new                                |   Milestone:            
Component:  django.contrib.admin               |     Version:  SVN       
 Keywords:  staff_member_required, FormWizard  |       Stage:  Unreviewed
Has_patch:  1                                  |  
-----------------------------------------------+----------------------------
 Hi,

 The "staff_member_required" decorator doesn't work for FormWizard or in
 general for decorating methods as for example _ _call_ _(). That's because
 the decorator expects the first argument to be a request instance but with
 methods the first argument is self and the second argument is the request
 object.

 The patch changes this by adding a check whether the object to be
 decorated is a function or a method. Then it decorates the appropriate
 way.

 In order to decorate FormWizard's _ _call_ _() you have to do this:

 {{{

 from django.contrib.formtools.wizard import FormWizard
 from django.contrib.admin.views.decorators import staff_member_required

 class Wizard(FormWizard):
     # ...
     pass

 Wizard.__call__ = staff_member_required(Wizard.__call__)
 }}}

 I added my changes as a patch.

 Alpha1650

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10525>
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