aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-04-03 18:55:55 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-04-03 18:55:55 -0500
commit59dd5c7e96ef454d7430727415309b43182590fa (patch)
treeebcd09b734a78db340a6bf2c80b0d2f4ab51b00d
parenta3fdcf5ce0fafe3ad50429a9a0870a40717ccb75 (diff)
downloadmediagoblin-59dd5c7e96ef454d7430727415309b43182590fa.tar.lz
mediagoblin-59dd5c7e96ef454d7430727415309b43182590fa.tar.xz
mediagoblin-59dd5c7e96ef454d7430727415309b43182590fa.zip
Functioning request.user, and a functioning greeting for users :)
-rw-r--r--mediagoblin/templates/mediagoblin/base.html2
-rw-r--r--mediagoblin/util.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html
index fa126857..546dc264 100644
--- a/mediagoblin/templates/mediagoblin/base.html
+++ b/mediagoblin/templates/mediagoblin/base.html
@@ -29,7 +29,7 @@
<tr>
<td></td>
<td>
- Welcome {{ user['username'] }}! --
+ Welcome {{ request.user['username'] }}! --
<a href="{{ request.urlgen('mediagoblin.auth.logout') }}">
Logout</a>
</td>
diff --git a/mediagoblin/util.py b/mediagoblin/util.py
index fe77a0d9..f5709123 100644
--- a/mediagoblin/util.py
+++ b/mediagoblin/util.py
@@ -34,12 +34,14 @@ def setup_user_in_request(request):
appropriate.
"""
if not request.session.has_key('user_id'):
+ request.user = None
return
user = None
try:
- user = request.db.User.one({'_id': request.session['user_id']})
+ user = request.db.User.one(
+ {'_id': mongokit.ObjectId(request.session['user_id'])})
if not user:
# Something's wrong... this user doesn't exist? Invalidate