equal
deleted
inserted
replaced
75 return res |
75 return res |
76 |
76 |
77 def cstrtype_mapping(cursor): |
77 def cstrtype_mapping(cursor): |
78 """cached constraint types mapping""" |
78 """cached constraint types mapping""" |
79 map = dict(cursor.execute('Any T, X WHERE X is CWConstraintType, X name T')) |
79 map = dict(cursor.execute('Any T, X WHERE X is CWConstraintType, X name T')) |
80 if not 'BoundConstraint' in map: |
|
81 map['BoundConstraint'] = map['BoundaryConstraint'] |
|
82 return map |
80 return map |
83 |
81 |
84 # schema / perms deserialization ############################################## |
82 # schema / perms deserialization ############################################## |
85 |
83 |
86 def deserialize_schema(schema, session): |
84 def deserialize_schema(schema, session): |
342 pb.update() |
340 pb.update() |
343 # serialize constraint types |
341 # serialize constraint types |
344 cstrtypemap = {} |
342 cstrtypemap = {} |
345 rql = 'INSERT CWConstraintType X: X name %(ct)s' |
343 rql = 'INSERT CWConstraintType X: X name %(ct)s' |
346 for cstrtype in CONSTRAINTS: |
344 for cstrtype in CONSTRAINTS: |
347 if cstrtype == 'BoundConstraint': |
|
348 continue # XXX deprecated in yams 0.29 / cw 3.8.1 |
|
349 cstrtypemap[cstrtype] = execute(rql, {'ct': unicode(cstrtype)}, |
345 cstrtypemap[cstrtype] = execute(rql, {'ct': unicode(cstrtype)}, |
350 build_descr=False)[0][0] |
346 build_descr=False)[0][0] |
351 if pb is not None: |
347 if pb is not None: |
352 pb.update() |
348 pb.update() |
353 cstrtypemap['BoundConstraint'] = cstrtypemap['BoundaryConstraint'] |
|
354 # serialize relations |
349 # serialize relations |
355 for rschema in schema.relations(): |
350 for rschema in schema.relations(): |
356 # skip virtual relations such as eid, has_text and identity |
351 # skip virtual relations such as eid, has_text and identity |
357 if rschema in VIRTUAL_RTYPES: |
352 if rschema in VIRTUAL_RTYPES: |
358 if pb is not None: |
353 if pb is not None: |