web/uicfg.py
changeset 7990 a673d1d9a738
parent 7897 defac26f4151
child 8238 087bb529035c
equal deleted inserted replaced
7989:db76e8aaec29 7990:a673d1d9a738
   241             sectdict['inlined'] = sectdict['main']
   241             sectdict['inlined'] = sectdict['main']
   242         # recompute formsections and set it to avoid recomputing
   242         # recompute formsections and set it to avoid recomputing
   243         for formtype, section in sectdict.iteritems():
   243         for formtype, section in sectdict.iteritems():
   244             formsections.add('%s_%s' % (formtype, section))
   244             formsections.add('%s_%s' % (formtype, section))
   245 
   245 
   246     def tag_relation(self, key, formtype, section=None):
   246     def tag_relation(self, key, formtype, section):
   247         if isinstance(formtype, tuple):
   247         if isinstance(formtype, tuple):
   248             for ftype in formtype:
   248             for ftype in formtype:
   249                 self.tag_relation(key, ftype, section)
   249                 self.tag_relation(key, ftype, section)
   250             return
   250             return
   251         if section is None:
       
   252             tag = formtype
       
   253             for formtype, section in self.bw_tag_map[tag].iteritems():
       
   254                 warn('[3.6] add tag to autoform section by specifying form '
       
   255                      'type and tag. Replace %s by formtype="%s", section="%s"'
       
   256                      % (tag, formtype, section), DeprecationWarning,
       
   257                      stacklevel=3)
       
   258                 self.tag_relation(key, formtype, section)
       
   259         assert formtype in self._allowed_form_types, \
   251         assert formtype in self._allowed_form_types, \
   260                'formtype should be in (%s), not %s' % (
   252                'formtype should be in (%s), not %s' % (
   261             ','.join(self._allowed_form_types), formtype)
   253             ','.join(self._allowed_form_types), formtype)
   262         assert section in self._allowed_values[formtype], \
   254         assert section in self._allowed_values[formtype], \
   263                'section for %s should be in (%s), not %s' % (
   255                'section for %s should be in (%s), not %s' % (
   448         if not rdef.role_cardinality(role) in '?1' and rdef.composite == role:
   440         if not rdef.role_cardinality(role) in '?1' and rdef.composite == role:
   449             rtag.tag_relation((sschema, rschema, oschema, role), True)
   441             rtag.tag_relation((sschema, rschema, oschema, role), True)
   450 
   442 
   451 actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu',
   443 actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu',
   452                                                init_actionbox_appearsin_addmenu)
   444                                                init_actionbox_appearsin_addmenu)
   453 
       
   454 
       
   455 # deprecated ###################################################################
       
   456 
       
   457 class AutoformIsInlined(RelationTags):
       
   458     """XXX for < 3.6 bw compat"""
       
   459     def tag_relation(self, key, tag):
       
   460         warn('autoform_is_inlined is deprecated, use autoform_section '
       
   461              'with formtype="main", section="inlined"',
       
   462              DeprecationWarning, stacklevel=3)
       
   463         section = tag and 'inlined' or 'hidden'
       
   464         autoform_section.tag_relation(key, 'main', section)
       
   465 
       
   466 # inlined view flag for non final relations: when True for an entry, the
       
   467 # entity(ies) at the other end of the relation will be editable from the
       
   468 # form of the edited entity
       
   469 autoform_is_inlined = AutoformIsInlined('autoform_is_inlined')