equal
deleted
inserted
replaced
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
7 """ |
7 """ |
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 from logilab.common.decorators import cached |
10 from logilab.common.decorators import cached |
|
11 |
|
12 from yams.schema import role_name |
11 |
13 |
12 from cubicweb import ValidationError |
14 from cubicweb import ValidationError |
13 from cubicweb.schema import ERQLExpression, RRQLExpression |
15 from cubicweb.schema import ERQLExpression, RRQLExpression |
14 |
16 |
15 from cubicweb.entities import AnyEntity, fetch_config |
17 from cubicweb.entities import AnyEntity, fetch_config |
62 # don't use the persistent schema, we may miss cardinality changes |
64 # don't use the persistent schema, we may miss cardinality changes |
63 # in the same transaction |
65 # in the same transaction |
64 for rdef in self.reverse_relation_type: |
66 for rdef in self.reverse_relation_type: |
65 card = rdef.cardinality[0] |
67 card = rdef.cardinality[0] |
66 if not card in '?1': |
68 if not card in '?1': |
|
69 qname = role_name('inlined', 'subject') |
67 rtype = self.name |
70 rtype = self.name |
68 stype = rdef.stype |
71 stype = rdef.stype |
69 otype = rdef.otype |
72 otype = rdef.otype |
70 msg = self._cw._("can't set inlined=%(inlined)s, " |
73 msg = self._cw._("can't set inlined=%(inlined)s, " |
71 "%(stype)s %(rtype)s %(otype)s " |
74 "%(stype)s %(rtype)s %(otype)s " |
72 "has cardinality=%(card)s") |
75 "has cardinality=%(card)s") |
73 raise ValidationError(self.eid, {'inlined': msg % locals()}) |
76 raise ValidationError(self.eid, {qname: msg % locals()}) |
74 |
77 |
75 def db_key_name(self): |
78 def db_key_name(self): |
76 """XXX goa specific""" |
79 """XXX goa specific""" |
77 return self.get('name') |
80 return self.get('name') |
78 |
81 |