[broken schema] fix the group_mapping function in case where some standard group isn't found: we currently loop for ever, boring the user by asking ever and ever the same question...
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 13 Jul 2010 17:21:57 +0200
changeset 5970 fb8acdab4e12
parent 5969 caea22e82d83
child 5971 6109bdb8ac06
[broken schema] fix the group_mapping function in case where some standard group isn't found: we currently loop for ever, boring the user by asking ever and ever the same question...
server/schemaserial.py
--- a/server/schemaserial.py	Tue Jul 13 16:07:41 2010 +0200
+++ b/server/schemaserial.py	Tue Jul 13 17:21:57 2010 +0200
@@ -26,7 +26,7 @@
 
 from yams import schema as schemamod, buildobjs as ybo
 
-from cubicweb import CW_SOFTWARE_ROOT
+from cubicweb import CW_SOFTWARE_ROOT, typed_eid
 from cubicweb.schema import (CONSTRAINTS, ETYPE_NAME_MAP,
                              VIRTUAL_RTYPES, PURE_VIRTUAL_RTYPES)
 from cubicweb.server import sqlutils
@@ -58,10 +58,18 @@
                 if not value:
                     continue
                 try:
-                    res[group] = int(value)
+                    eid = typed_eid(value)
                 except ValueError:
                     print 'eid should be an integer'
                     continue
+                for eid_ in res.values():
+                    if eid == eid_:
+                        break
+                else:
+                    print 'eid is not a group eid'
+                    continue
+                res[name] = eid
+                break
     return res
 
 def cstrtype_mapping(cursor):