54 uicfg.actionbox_appearsin_addmenu.tag_object_of(('*', 'entry_of', 'Blog'), True) |
54 uicfg.actionbox_appearsin_addmenu.tag_object_of(('*', 'entry_of', 'Blog'), True) |
55 """ |
55 """ |
56 __docformat__ = "restructuredtext en" |
56 __docformat__ = "restructuredtext en" |
57 |
57 |
58 from warnings import warn |
58 from warnings import warn |
|
59 |
|
60 from six import string_types |
59 |
61 |
60 from cubicweb import neg_role |
62 from cubicweb import neg_role |
61 from cubicweb.rtags import (RelationTags, RelationTagsBool, RelationTagsSet, |
63 from cubicweb.rtags import (RelationTags, RelationTagsBool, RelationTagsSet, |
62 RelationTagsDict, NoTargetRelationTagsDict, |
64 RelationTagsDict, NoTargetRelationTagsDict, |
63 _ensure_str_key) |
65 _ensure_str_key) |
648 rdef = rschema.rdef(sschema, oschema) |
650 rdef = rschema.rdef(sschema, oschema) |
649 if not rdef.role_cardinality(role) in '?1' and rdef.composite == role: |
651 if not rdef.role_cardinality(role) in '?1' and rdef.composite == role: |
650 self.tag_relation((sschema, rschema, oschema, role), True) |
652 self.tag_relation((sschema, rschema, oschema, role), True) |
651 |
653 |
652 def _tag_etype_attr(self, etype, attr, desttype='*', *args, **kwargs): |
654 def _tag_etype_attr(self, etype, attr, desttype='*', *args, **kwargs): |
653 if isinstance(attr, basestring): |
655 if isinstance(attr, string_types): |
654 attr, role = attr, 'subject' |
656 attr, role = attr, 'subject' |
655 else: |
657 else: |
656 attr, role = attr |
658 attr, role = attr |
657 if role == 'subject': |
659 if role == 'subject': |
658 self.tag_subject_of((etype, attr, desttype), *args, **kwargs) |
660 self.tag_subject_of((etype, attr, desttype), *args, **kwargs) |