entity.py
branchtls-sprint
changeset 1739 78b0819162a8
parent 1734 e8673144bc74
child 1754 c9c7618a90de
equal deleted inserted replaced
1738:2cfd50c8a415 1739:78b0819162a8
    48     from cubicweb.web import formwidgets, uicfg
    48     from cubicweb.web import formwidgets, uicfg
    49 
    49 
    50     def _dispatch_rtags(tags, rtype, role, stype, otype):
    50     def _dispatch_rtags(tags, rtype, role, stype, otype):
    51         for tag in tags:
    51         for tag in tags:
    52             if tag in _MODE_TAGS:
    52             if tag in _MODE_TAGS:
    53                 uicfg.rmode.tag_relation(stype, rtype, otype, tag, role)
    53                 uicfg.actionbox_appearsin_addmenu.tag_relation(
       
    54                     (stype, rtype, otype, role), tag == 'create')
    54             elif tag in _CATEGORY_TAGS:
    55             elif tag in _CATEGORY_TAGS:
    55                 uicfg.rcategories.tag_relation(stype, rtype, otype, tag, role)
    56                 uicfg.autoform_section.tag_relation((stype, rtype, otype, role),
       
    57                                                     tag)
    56             elif tag == 'inlineview':
    58             elif tag == 'inlineview':
    57                 uicfg.rinlined.tag_relation(stype, rtype, otype, True, role)
    59                 uicfg.autoform_is_inlined.tag_relation((stype, rtype, otype, role), True)
    58             else:
    60             else:
    59                 raise ValueError(tag)
    61                 raise ValueError(tag)
    60 
    62 
    61 except ImportError:
    63 except ImportError:
    62 
    64 
   126                         continue
   128                         continue
   127                     if wdgname == 'StringWidget':
   129                     if wdgname == 'StringWidget':
   128                         wdgname = 'TextInput'
   130                         wdgname = 'TextInput'
   129                     widget = getattr(formwidgets, wdgname)
   131                     widget = getattr(formwidgets, wdgname)
   130                     assert hasattr(widget, 'render')
   132                     assert hasattr(widget, 'render')
   131                     uicfg.rwidgets.tag_relation(
   133                     uicfg.autoform_widget.tag_subject_of((etype, rtype, '*'),
   132                         etype, rtype, '*', widget, tagged='subject')
   134                                                          widget)
   133         return super(_metaentity, mcs).__new__(mcs, name, bases, classdict)
   135         return super(_metaentity, mcs).__new__(mcs, name, bases, classdict)
   134 
   136 
   135 
   137 
   136 class Entity(AppRsetObject, dict):
   138 class Entity(AppRsetObject, dict):
   137     """an entity instance has e_schema automagically set on
   139     """an entity instance has e_schema automagically set on