#17296: staff_login_required decorator redirecting  to default Login redirect
instead of requested
-------------------------------+--------------------------------------
     Reporter:  ayarshabeer    |                    Owner:  nobody
         Type:  Bug            |                   Status:  closed
    Component:  HTTP handling  |                  Version:  1.3
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by aaugustin):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 Django doesn't define a `staff_required` decorator. I assume you're
 referring of the `staff_member_required` decorator defined by the `admin`
 contrib app, and used by `admindocs`?

 I checked how the admin behaves: if I make an unauthenticated request to
 http://<mysite>/admin/<app>/<model>/, I'm presented the login form, and
 then the page I asked for. So I couldn't reproduce the bug at this level.
 I obtained the same behavior with admindocs.

 Then, this decorator isn't documented; it's an internal API. As long as
 the admin and admindocs app behaves as expected, it's doing its job.

 Finally, I don't understand very well your explanation. If the URL is
 relative, `netloc` will be the empty string in the piece of code you're
 quoting:
 {{{
 >>> import urlparse
 >>> urlparse.urlparse('/foo/bar')
 ParseResult(scheme='', netloc='', path='/foo/bar', params='', query='',
 fragment='')
 >>> urlparse.urlparse('/foo/bar')[1]
 ''
 }}}
 This means that the `elif netloc and ...` clause doesn't apply. This
 clause isn't the reason why you're redirected to LOGIN_REDIRECT_URL.

 At this point, I don't have the proof that something's wrong in Django,
 and I don't have enough information to reproduce your problem, so I'm
 going to close this ticket.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17296#comment:2>
Django <https://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