Dot-Notation for Users.verification_key
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 14 Nov 2011 18:04:13 +0000 (19:04 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 5 Dec 2011 20:08:57 +0000 (21:08 +0100)
mediagoblin/auth/lib.py
mediagoblin/auth/views.py
mediagoblin/tests/test_auth.py

index 24992094e6f79641fe526d91f1aa2b46cb945c4d..d03f7af0f7cd815b7e473402c95c6aa3cd5d9b13 100644 (file)
@@ -110,7 +110,7 @@ def send_verification_email(user, request):
                 host=request.host,
                 uri=request.urlgen('mediagoblin.auth.verify_email'),
                 userid=unicode(user._id),
-                verification_key=user['verification_key'])})
+                verification_key=user.verification_key)})
 
     # TODO: There is no error handling in place
     send_email(
index caf9835a6974f646dc5b23908edf2c78d40a58c4..d7e8d1bf7cf91239f510aa4204c48145713b0232 100644 (file)
@@ -166,10 +166,10 @@ def verify_email(request):
     user = request.db.User.find_one(
         {'_id': ObjectId(unicode(request.GET['userid']))})
 
-    if user and user['verification_key'] == unicode(request.GET['token']):
+    if user and user.verification_key == unicode(request.GET['token']):
         user.status = u'active'
         user.email_verified = True
-        user[u'verification_key'] = None
+        user.verification_key = None
 
         user.save()
 
@@ -212,7 +212,7 @@ def resend_activation(request):
         
         return redirect(request, "mediagoblin.user_pages.user_home", user=request.user['username'])
 
-    request.user[u'verification_key'] = unicode(uuid.uuid4())
+    request.user.verification_key = unicode(uuid.uuid4())
     request.user.save()
     
     email_debug_message(request)
index bd79a40750ad6c859dfde9672c79f3e902f00147..7cb867d780a012df5571ebe09abaaca9dba33fa4 100644 (file)
@@ -187,7 +187,7 @@ def test_register_views(test_app):
     assert parsed_get_params['userid'] == [
         unicode(new_user._id)]
     assert parsed_get_params['token'] == [
-        new_user['verification_key']]
+        new_user.verification_key]
 
     ## Try verifying with bs verification key, shouldn't work
     template.clear_test_template_context()