changed occurances of form.data['whatever'] to form.whatever.data
authorRodney Ewing <ewing.rj@gmail.com>
Thu, 23 May 2013 20:18:47 +0000 (13:18 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Fri, 24 May 2013 23:52:49 +0000 (16:52 -0700)
Conflicts:
mediagoblin/plugins/basic_auth/__init__.py
mediagoblin/plugins/openid/__init__.py

mediagoblin/auth/tools.py
mediagoblin/plugins/basic_auth/__init__.py

index a1273d3b92b204f6e2ddfbad3b1a0472be68c96a..ac2f65048aacd70fc0e139ddefc4e981306cd7b3 100644 (file)
@@ -90,9 +90,9 @@ def no_auth_logout(request):
 
 def basic_extra_validation(register_form, *args):
     users_with_username = User.query.filter_by(
-        username=register_form.data['username']).count()
+        username=register_form.username.data).count()
     users_with_email = User.query.filter_by(
-        email=register_form.data['email']).count()
+        email=register_form.email.data).count()
 
     extra_validation_passes = True
 
index 8dc2e38179a98a869b5844e2fbe5889dee65634d..74d6b8360f27c5b4ac79b8a9468b683e7f804d8c 100644 (file)
@@ -35,21 +35,22 @@ def check_login(user, password):
 
 
 def get_user(form):
-    username = form.data['username']
-    user = User.query.filter(
-        or_(
-            User.username == username,
-            User.email == username,
-        )).first()
-    return user
+    if 'username' in form.data:
+        username = form.username.data
+        user = User.query.filter(
+            or_(
+                User.username == username,
+                User.email == username,
+            )).first()
+        return user
 
 
 def create_user(registration_form):
     user = get_user(registration_form)
     if not user and 'password' in registration_form:
         user = User()
-        user.username = registration_form.data['username']
-        user.email = registration_form.data['email']
+        user.username = registration_form.username.data
+        user.email = registration_form.email.data
         user.pw_hash = auth_lib.bcrypt_gen_password_hash(
             registration_form.password.data)
         user.verification_key = unicode(uuid.uuid4())