fix schema serialization, bad repartition of changes between stable and default stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 04 Mar 2010 10:56:27 +0100
branchstable
changeset 4791 b9a1b16a8d26
parent 4789 c93770e4aaf4
child 4792 e46c6e01117b
fix schema serialization, bad repartition of changes between stable and default
server/schemaserial.py
--- a/server/schemaserial.py	Thu Mar 04 10:22:21 2010 +0100
+++ b/server/schemaserial.py	Thu Mar 04 10:56:27 2010 +0100
@@ -51,6 +51,7 @@
     return res
 
 # schema / perms deserialization ##############################################
+
 def deserialize_schema(schema, session):
     """return a schema according to information stored in an rql database
     as CWRType and CWEType entities
@@ -215,13 +216,15 @@
         print _title,
     execute = cursor.unsafe_execute
     eschemas = schema.entities()
-    aller = eschemas + schema.relations()
     if not quiet:
-        pb_size = len(aller) + len(CONSTRAINTS) + len([x for x in eschemas if x.specializes()])
+        pb_size = (len(eschemas + schema.relations())
+                   + len(CONSTRAINTS)
+                   + len([x for x in eschemas if x.specializes()]))
         pb = ProgressBar(pb_size, title=_title)
     else:
         pb = None
     # serialize all entity types, assuring CWEType is serialized first
+    groupmap = group_mapping(cursor)
     eschemas.remove(schema.eschema('CWEType'))
     eschemas.insert(0, schema.eschema('CWEType'))
     for eschema in eschemas:
@@ -242,12 +245,12 @@
             if pb is not None:
                 pb.update()
             continue
-        for rql, kwargs in erschema2rql(schema[ertype], groupmap):
+        for rql, kwargs in rschema2rql(rschema, groupmap):
             execute(rql, kwargs, build_descr=False)
         if pb is not None:
             pb.update()
     for rql, kwargs in specialize2rql(schema):
-        assert execute(rql, kwargs, build_descr=False)
+        execute(rql, kwargs, build_descr=False)
         if pb is not None:
             pb.update()
     if not quiet: