241 attrs = dict(zip( |
241 attrs = dict(zip( |
242 ('rdefeid', 'seid', 'reid', 'oeid', 'cardinality', |
242 ('rdefeid', 'seid', 'reid', 'oeid', 'cardinality', |
243 'order', 'description', 'indexed', 'fulltextindexed', |
243 'order', 'description', 'indexed', 'fulltextindexed', |
244 'internationalizable', 'default', 'formula'), values)) |
244 'internationalizable', 'default', 'formula'), values)) |
245 typeparams = extra_props.get(attrs['rdefeid']) |
245 typeparams = extra_props.get(attrs['rdefeid']) |
246 attrs.update(json.load(typeparams) if typeparams else {}) |
246 attrs.update(json.loads(typeparams.getvalue().decode('ascii')) if typeparams else {}) |
247 default = attrs['default'] |
247 default = attrs['default'] |
248 if default is not None: |
248 if default is not None: |
249 if isinstance(default, Binary): |
249 if isinstance(default, Binary): |
250 # while migrating from 3.17 to 3.18, we still have to |
250 # while migrating from 3.17 to 3.18, we still have to |
251 # handle String defaults |
251 # handle String defaults |
588 value = unicode(value) |
588 value = unicode(value) |
589 if value is not None and prop == 'default': |
589 if value is not None and prop == 'default': |
590 value = Binary.zpickle(value) |
590 value = Binary.zpickle(value) |
591 values[amap.get(prop, prop)] = value |
591 values[amap.get(prop, prop)] = value |
592 if extra: |
592 if extra: |
593 values['extra_props'] = Binary(json.dumps(extra)) |
593 values['extra_props'] = Binary(json.dumps(extra).encode('ascii')) |
594 relations = ['X %s %%(%s)s' % (attr, attr) for attr in sorted(values)] |
594 relations = ['X %s %%(%s)s' % (attr, attr) for attr in sorted(values)] |
595 return relations, values |
595 return relations, values |
596 |
596 |
597 def constraints2rql(cstrtypemap, constraints, rdefeid=None): |
597 def constraints2rql(cstrtypemap, constraints, rdefeid=None): |
598 for constraint in constraints: |
598 for constraint in constraints: |