entity.py
branchtls-sprint
changeset 1721 694f6a50e138
parent 1582 67a86c70e42e
child 1734 e8673144bc74
equal deleted inserted replaced
1720:14c9a0a1aca1 1721:694f6a50e138
    49     from cubicweb.web.views.editforms import AutomaticEntityForm
    49     from cubicweb.web.views.editforms import AutomaticEntityForm
    50 
    50 
    51     def _dispatch_rtags(tags, rtype, role, stype, otype):
    51     def _dispatch_rtags(tags, rtype, role, stype, otype):
    52         for tag in tags:
    52         for tag in tags:
    53             if tag in _MODE_TAGS:
    53             if tag in _MODE_TAGS:
    54                 uicfg.rmode.tag_relation(tag, (stype, rtype, otype), role)
    54                 uicfg.rmode.tag_relation(stype, rtype, otype, tag, role)
    55             elif tag in _CATEGORY_TAGS:
    55             elif tag in _CATEGORY_TAGS:
    56                 uicfg.rcategories.tag_relation(tag, (stype, rtype, otype), role)
    56                 uicfg.rcategories.tag_relation(stype, rtype, otype, tag, role)
    57             elif tag == 'inlineview':
    57             elif tag == 'inlineview':
    58                 uicfg.rinlined.tag_relation(True, (stype, rtype, otype), role)
    58                 uicfg.rinlined.tag_relation(stype, rtype, otype, True, role)
    59             else:
    59             else:
    60                 raise ValueError(tag)
    60                 raise ValueError(tag)
    61 
    61 
    62 except ImportError:
    62 except ImportError:
    63     _dispatch_rtags = None
    63     _dispatch_rtags = None
   127                     if wdgname == 'StringWidget':
   127                     if wdgname == 'StringWidget':
   128                         wdgname = 'TextInput'
   128                         wdgname = 'TextInput'
   129                     widget = getattr(formwidgets, wdgname)
   129                     widget = getattr(formwidgets, wdgname)
   130                     assert hasattr(widget, 'render')
   130                     assert hasattr(widget, 'render')
   131                     AutomaticEntityForm.rwidgets.tag_relation(
   131                     AutomaticEntityForm.rwidgets.tag_relation(
   132                         widget, (etype, rtype, '*'), 'subject')
   132                         etype, rtype, '*', widget, tagged='subject')
   133         return super(_metaentity, mcs).__new__(mcs, name, bases, classdict)
   133         return super(_metaentity, mcs).__new__(mcs, name, bases, classdict)
   134 
   134 
   135 
   135 
   136 class Entity(AppRsetObject, dict):
   136 class Entity(AppRsetObject, dict):
   137     """an entity instance has e_schema automagically set on
   137     """an entity instance has e_schema automagically set on