#8457: typo in sessions file backend can cause NameError
------------------------------------+---------------------------------------
Reporter: carljm | Owner: nobody
Status: new | Milestone: 1.0
Component: Uncategorized | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Comment (by carljm):
Sorry, I didn't realize errno was available as a top-level import. The
bug still exists, but in that case a just-as-good fix would be to import
errno at the top of contrib/sessions/backends/file.py. It currently is
not imported and I am definitely able to raise a NameError. On SVN r8449,
set SESSION_FILE_PATH = '/', run "./manage.py shell":
{{{
>>> from django.contrib.sessions.backends.file import SessionStore;
SessionStore().create()
Traceback (most recent call last):
File "<console>", line 1, in ?
File "/var/www/meyer/lib/py/django/contrib/sessions/backends/file.py",
line 6e
self.save(must_create=True)
File "/var/www/meyer/lib/py/django/contrib/sessions/backends/file.py",
line 8e
if must_create and e.errno == errno.EEXIST:
NameError: global name 'errno' is not defined
}}}
My fix also works; os.errno does exist:
{{{
[EMAIL PROTECTED]:~$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.errno
<module 'errno' (built-in)>
>>> os.errno.EEXIST
17
}}}
There's nothing nonstandard about my setup, Python 2.5.2 straight from the
Ubuntu repos.
--
Ticket URL: <http://code.djangoproject.com/ticket/8457#comment:2>
Django Code <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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---