54 stereotypes.append(_('final')) |
54 stereotypes.append(_('final')) |
55 if stereotypes: |
55 if stereotypes: |
56 return u'%s <<%s>>' % (self.dc_title(), ', '.join(stereotypes)) |
56 return u'%s <<%s>>' % (self.dc_title(), ', '.join(stereotypes)) |
57 return self.dc_title() |
57 return self.dc_title() |
58 |
58 |
59 def inlined_changed(self, inlined): |
59 def check_inlined_allowed(self): |
60 """check inlining is necessary and possible: |
60 """check inlining is possible, raise ValidationError if not possible |
61 |
61 """ |
62 * return False if nothing has changed |
62 # don't use the persistent schema, we may miss cardinality changes |
63 * raise ValidationError if inlining is'nt possible |
63 # in the same transaction |
64 * eventually return True |
64 for rdef in self.reverse_relation_type: |
65 """ |
65 card = rdef.cardinality[0] |
66 rschema = self._cw.vreg.schema.rschema(self.name) |
66 if not card in '?1': |
67 if inlined == rschema.inlined: |
67 rtype = self.name |
68 return False |
68 stype = rdef.stype |
69 if inlined: |
69 otype = rdef.otype |
70 # don't use the persistent schema, we may miss cardinality changes |
70 msg = self._cw._("can't set inlined=%(inlined)s, " |
71 # in the same transaction |
71 "%(stype)s %(rtype)s %(otype)s " |
72 for rdef in self.reverse_relation_type: |
72 "has cardinality=%(card)s") |
73 card = rdef.cardinality[0] |
73 raise ValidationError(self.eid, {'inlined': msg % locals()}) |
74 if not card in '?1': |
|
75 rtype = self.name |
|
76 stype = rdef.stype |
|
77 otype = rdef.otype |
|
78 msg = self._cw._("can't set inlined=%(inlined)s, " |
|
79 "%(stype)s %(rtype)s %(otype)s " |
|
80 "has cardinality=%(card)s") |
|
81 raise ValidationError(self.eid, {'inlined': msg % locals()}) |
|
82 return True |
|
83 |
74 |
84 def db_key_name(self): |
75 def db_key_name(self): |
85 """XXX goa specific""" |
76 """XXX goa specific""" |
86 return self.get('name') |
77 return self.get('name') |
87 |
78 |