New versions of django break login_required

3 views
Skip to first unread message

Akatemik

unread,
Jul 28, 2006, 3:03:51 PM7/28/06
to Django users
Revision 3461 breaks down my app oddly. Somehow I'm able to access some
of the views (general views) but when I use a view in my app, I get:

Exception Type: TypeError
Exception Value: readonly attribute
Exception Location:
/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/contrib/auth/decorators.py
in _dec, line 18

Traceback (most recent call last):
File
"/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/core/handlers/base.py"
in get_response
65. callback, callback_args, callback_kwargs = resolver.resolve(path)
File
"/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/core/urlresolvers.py"
in resolve
147. sub_match = pattern.resolve(new_path)
File
"/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/core/urlresolvers.py"
in resolve
112. self.func = self.get_callback()
File
"/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/core/urlresolvers.py"
in get_callback
118. return getattr(__import__(mod_name, '', '', ['']), func_name)
File
"/home/hukka/work/programs/django/teekkarikyla/../teekkarikyla/kirjasto/views.py"
in ?
54. add_book = login_required(add_book)
File
"/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/contrib/auth/decorators.py"
in _dec
18. _checklogin.__name__ = view_func.__name__

TypeError at /accounts/verify/
readonly attribute

If I reload the page, the error changes into:
Exception Type: ViewDoesNotExist
Exception Value: Tried verify in module teekkarikyla.kirjasto.views.
Error was: 'module' object has no attribute 'verify'
Exception Location:
/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/core/urlresolvers.py
in get_callback, line 122

I can get back to TypeError by restarting my server. Running Django on
the internal server on Debian unstable's Python2.3.

Jeremy Osterhouse

unread,
Jul 28, 2006, 5:14:40 PM7/28/06
to Django users
I ran into this problem as well. I believe the source of the problem is
here:

> File
> "/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/contrib/auth/decorators.py"
> in _dec
> 18. _checklogin.__name__ = view_func.__name__

If "readonly attribute" is to be believed, then I *think* __name__ is
readonly. This confirms it:
>>> def foo():
... pass
...
>>> foo.__name__ = "bar"


Traceback (most recent call last):

File "<stdin>", line 1, in ?
TypeError: readonly attribute

Switching to Python 2.4.3 solved the problem for me.

Adrian Holovaty

unread,
Jul 28, 2006, 5:24:57 PM7/28/06
to django...@googlegroups.com
On 7/28/06, Jeremy Osterhouse <joste...@gmail.com> wrote:
> I ran into this problem as well. I believe the source of the problem is
> here:
> > File
> > "/usr/lib/python2.3/site-packages/Django-0.95-py2.3.egg/django/contrib/auth/decorators.py"
> > in _dec
> > 18. _checklogin.__name__ = view_func.__name__

I've reverted the assignment of __name__ -- thanks for pointing this
out! Looks to be a problem with different behavior across Python
versions, perhaps?

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

Jay Parlar

unread,
Jul 28, 2006, 5:28:16 PM7/28/06
to django...@googlegroups.com
On 7/28/06, Adrian Holovaty <holo...@gmail.com> wrote:

> I've reverted the assignment of __name__ -- thanks for pointing this
> out! Looks to be a problem with different behavior across Python
> versions, perhaps?
>

Yep, see http://www.python.org/download/releases/2.4/notes/#what-s-new-in-python-2-4-alpha-3

Jay P.

Reply all
Reply to author
Forward
0 new messages