diff pylons_app/model/user_model.py @ 530:a08f610e545e

Implemented server side forks added ability to pass session to user/repo models
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 01 Oct 2010 00:16:09 +0200
parents a3d9d24acbec
children
line wrap: on
line diff
--- a/pylons_app/model/user_model.py	Thu Sep 30 18:35:03 2010 +0200
+++ b/pylons_app/model/user_model.py	Fri Oct 01 00:16:09 2010 +0200
@@ -36,8 +36,11 @@
 
 class UserModel(object):
 
-    def __init__(self):
-        self.sa = Session() 
+    def __init__(self, sa=None):
+        if not sa:
+            self.sa = Session()
+        else:
+            self.sa = sa
     
     def get_default(self):
         return self.sa.query(User).filter(User.username == 'default').scalar()