[server] eschema_eid needs a connection, not a session
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 01 Apr 2014 16:12:50 +0200
changeset 9610 29450466273a
parent 9609 e7d38148799e
child 9611 ca853478aaa8
[server] eschema_eid needs a connection, not a session
server/utils.py
--- a/server/utils.py	Tue Apr 01 15:53:21 2014 +0200
+++ b/server/utils.py	Tue Apr 01 16:12:50 2014 +0200
@@ -73,13 +73,13 @@
     return ''
 
 
-def eschema_eid(session, eschema):
+def eschema_eid(cnx, eschema):
     """get eid of the CWEType entity for the given yams type. You should use
     this because when schema has been loaded from the file-system, not from the
     database, (e.g. during tests), eschema.eid is not set.
     """
     if eschema.eid is None:
-        eschema.eid = session.execute(
+        eschema.eid = cnx.execute(
             'Any X WHERE X is CWEType, X name %(name)s',
             {'name': str(eschema)})[0][0]
     return eschema.eid