aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-04-03 18:56:48 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-04-03 18:56:48 -0500
commitc74e1462feed4c8be9b3004893df2bf236b422cc (patch)
tree1cc05e7215e4cec22906ae8c36613c9894887a3a
parent59dd5c7e96ef454d7430727415309b43182590fa (diff)
downloadmediagoblin-c74e1462feed4c8be9b3004893df2bf236b422cc.tar.lz
mediagoblin-c74e1462feed4c8be9b3004893df2bf236b422cc.tar.xz
mediagoblin-c74e1462feed4c8be9b3004893df2bf236b422cc.zip
Since we're searching by id, that try: except: was superfluous.
-rw-r--r--mediagoblin/util.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/mediagoblin/util.py b/mediagoblin/util.py
index f5709123..6551a3cc 100644
--- a/mediagoblin/util.py
+++ b/mediagoblin/util.py
@@ -38,19 +38,12 @@ def setup_user_in_request(request):
return
user = None
+ user = request.db.User.one(
+ {'_id': mongokit.ObjectId(request.session['user_id'])})
- try:
- user = request.db.User.one(
- {'_id': mongokit.ObjectId(request.session['user_id'])})
-
- if not user:
- # Something's wrong... this user doesn't exist? Invalidate
- # this session.
- request.session.invalidate()
-
- except mongokit.MultipleResultsFound:
- # Something's wrong... we shouldn't have multiple users with
- # the same user id. Invalidate this session.
+ if not user:
+ # Something's wrong... this user doesn't exist? Invalidate
+ # this session.
request.session.invalidate()
request.user = user