Commits

Chris Miles committed 17f124f

Changed the user->user_activation mapping from one-to-many to one-to-one, which makes more sense.

Comments (0)

Files changed (2)

BlastOff/blastoff/template/+package+/controllers/account.py_tmpl

             user = Session.query(User).filter_by(user_name=user_name).first()
             if user is not None:
                 key = request.params.get('key')
-                if key and user.activation and user.activation[0]:
-                    activation = user.activation[0]
-                    if activation.key == key:
-                        Session.delete(activation)
+                if key and user.activation:
+                    if user.activation.key == key:
+                        Session.delete(user.activation)
                         user.activated = True
                         Session.commit()
                         success = True

BlastOff/blastoff/template/+package+/model/__init__.py_tmpl

 
 orm.mapper(User, user_table,
 {{if email_confirmation}}
-    properties = dict(    
-        activation = sa.orm.relation(UserActivation, backref='user', cascade="all, delete, delete-orphan"),
+    properties = dict(
+        activation = sa.orm.relation(UserActivation, backref='user', uselist=False, cascade="all, delete, delete-orphan"),
     )
 {{endif}}
 )