magic-removal: More various fixes

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1649 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-12-14 19:12:47 +00:00
parent 47a0ec00f2
commit ecc57b0b07
3 changed files with 4 additions and 4 deletions

View File

@ -103,7 +103,7 @@ class ModPythonRequest(httpwrappers.HttpRequest):
if not user_id: if not user_id:
raise ValueError raise ValueError
self._user = User.objects.get_object(pk=user_id) self._user = User.objects.get_object(pk=user_id)
except (AttributeError, KeyError, ValueError, user.DoesNotExist): except (AttributeError, KeyError, ValueError, User.DoesNotExist):
from django.parts.auth import anonymoususers from django.parts.auth import anonymoususers
self._user = anonymoususers.AnonymousUser() self._user = anonymoususers.AnonymousUser()
return self._user return self._user

View File

@ -124,7 +124,7 @@ class WSGIRequest(httpwrappers.HttpRequest):
if not user_id: if not user_id:
raise ValueError raise ValueError
self._user = User.objects.get_object(pk=user_id) self._user = User.objects.get_object(pk=user_id)
except (AttributeError, KeyError, ValueError, user.DoesNotExist): except (AttributeError, KeyError, ValueError, User.DoesNotExist):
from django.parts.auth import anonymoususers from django.parts.auth import anonymoususers
self._user = anonymoususers.AnonymousUser() self._user = anonymoususers.AnonymousUser()
return self._user return self._user

View File

@ -81,12 +81,12 @@ class SessionManager(models.Manager):
session_key = md5.new(str(random.randint(0, sys.maxint - 1)) + SECRET_KEY).hexdigest() session_key = md5.new(str(random.randint(0, sys.maxint - 1)) + SECRET_KEY).hexdigest()
try: try:
self.get_object(session_key__exact=session_key) self.get_object(session_key__exact=session_key)
except SessionDoesNotExist: except self.klass.DoesNotExist:
break break
return session_key return session_key
def save(self, session_key, session_dict, expire_date): def save(self, session_key, session_dict, expire_date):
s = self.klass(session_key, encode(session_dict), expire_date) s = self.klass(session_key, self.encode(session_dict), expire_date)
if session_dict: if session_dict:
s.save() s.save()
else: else: