server/__init__.py
branchstable
changeset 4634 b2a3232783f8
parent 4612 d6ae30c5d055
child 4759 af2e6c377c71
--- a/server/__init__.py	Thu Feb 18 13:28:38 2010 +0100
+++ b/server/__init__.py	Thu Feb 18 13:30:37 2010 +0100
@@ -96,10 +96,11 @@
 def create_user(session, login, pwd, *groups):
     # monkey patch this method if you want to customize admin/anon creation
     # (that maybe necessary if you change CWUser's schema)
-    session.create_entity('CWUser', login=login, upassword=pwd)
+    user = session.create_entity('CWUser', login=login, upassword=pwd)
     for group in groups:
-        session.execute('SET U in_group G WHERE G name %(group)s',
-                        {'group': group})
+        session.execute('SET U in_group G WHERE U eid %(u)s, G name %(group)s',
+                        {'u': user.eid, 'group': group})
+    return user
 
 def init_repository(config, interactive=True, drop=False, vreg=None):
     """initialise a repository database by creating tables add filling them