[schemaserial] Replace 'cursor' with 'cnx'
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 30 Jan 2014 16:48:39 +0100
changeset 9503 562cef272a35
parent 9501 2904e2ba81a0
child 9504 71a11bca251d
[schemaserial] Replace 'cursor' with 'cnx' We don't have cursors in rql, since execute is synchronous.
server/schemaserial.py
--- a/server/schemaserial.py	Wed Jan 29 16:03:42 2014 +0100
+++ b/server/schemaserial.py	Thu Jan 30 16:48:39 2014 +0100
@@ -33,7 +33,7 @@
 from cubicweb.server import sqlutils
 
 
-def group_mapping(cursor, interactive=True):
+def group_mapping(cnx, interactive=True):
     """create a group mapping from an rql cursor
 
     A group mapping has standard group names as key (managers, owners at least)
@@ -42,7 +42,7 @@
     from the user.
     """
     res = {}
-    for eid, name in cursor.execute('Any G, N WHERE G is CWGroup, G name N',
+    for eid, name in cnx.execute('Any G, N WHERE G is CWGroup, G name N',
                                     build_descr=False):
         res[name] = eid
     if not interactive:
@@ -305,7 +305,7 @@
 
 # schema / perms serialization ################################################
 
-def serialize_schema(cursor, schema):
+def serialize_schema(cnx, schema):
     """synchronize schema and permissions in the database according to
     current schema
     """
@@ -313,7 +313,7 @@
     if not quiet:
         _title = '-> storing the schema in the database '
         print _title,
-    execute = cursor.execute
+    execute = cnx.execute
     eschemas = schema.entities()
     if not quiet:
         pb_size = (len(eschemas + schema.relations())
@@ -322,7 +322,7 @@
         pb = ProgressBar(pb_size, title=_title)
     else:
         pb = None
-    groupmap = group_mapping(cursor, interactive=False)
+    groupmap = group_mapping(cnx, interactive=False)
     # serialize all entity types, assuring CWEType is serialized first for proper
     # is / is_instance_of insertion
     eschemas.remove(schema.eschema('CWEType'))