Compare user by id not object equality
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Sun, 23 Dec 2012 11:12:11 +0000 (12:12 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Sun, 23 Dec 2012 11:12:11 +0000 (12:12 +0100)
Elrond correctly remarked that we should be comparing user by id
and not by comparing User objects (as I mistakenly did). He is
right, of course!

Also removing the 2 stray debug prints that were left over.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
mediagoblin/user_pages/views.py

index 79345a4e34b8c88b8762cf9e7c74c34364155d48..33828c1bdbcb10ce300c15b01a57345c4498d805 100644 (file)
@@ -578,11 +578,8 @@ def processing_panel(request):
     #
     # Make sure we have permission to access this user's panel.  Only
     # admins and this user herself should be able to do so.
-    if not (user == request.user
-            or request.user.is_admin):
+    if not (user.id == request.user.id or request.user.is_admin):
         # No?  Simply redirect to this user's homepage.
-        print user
-        print request.user
         return redirect(
             request, 'mediagoblin.user_pages.user_home',
             user=user.username)