cubicweb/rtags.py
changeset 11932 7b2247098f58
parent 11888 0849a5eb57b8
child 12212 f2e6fb5ddf68
equal deleted inserted replaced
11931:ad7796dabeaa 11932:7b2247098f58
    75     _allowed_values = None
    75     _allowed_values = None
    76     # _init expected to be a method (introduced in 3.17), while _initfunc a
    76     # _init expected to be a method (introduced in 3.17), while _initfunc a
    77     # function given as __init__ argument and kept for bw compat
    77     # function given as __init__ argument and kept for bw compat
    78     _init = _initfunc = None
    78     _init = _initfunc = None
    79 
    79 
    80     def __init__(self, parent=None):
    80     def __init__(self, parent=None, __module__=None):
       
    81         super(RelationTags, self).__init__(__module__)
    81         self._tagdefs = {}
    82         self._tagdefs = {}
    82         self._parent = parent
    83         self._parent = parent
    83         if parent is not None:
    84         if parent is not None:
    84             assert parent.__class__ is self.__class__, \
    85             assert parent.__class__ is self.__class__, \
    85                 'inconsistent class for parent rtag {0}'.format(parent)
    86                 'inconsistent class for parent rtag {0}'.format(parent)
   141         This derivated will hold a set of specific rules but delegate to its "parent" relation tags
   142         This derivated will hold a set of specific rules but delegate to its "parent" relation tags
   142         for unfound keys.
   143         for unfound keys.
   143 
   144 
   144         >>> class_afs = uicfg.autoform_section.derive(__name__, is_instance('Class'))
   145         >>> class_afs = uicfg.autoform_section.derive(__name__, is_instance('Class'))
   145         """
   146         """
   146         copied = self.__class__(self)
   147         copied = self.__class__(self, __module__=__name__)
   147         copied.__module__ = module
   148         copied.__module__ = module
   148         copied.__select__ = select
   149         copied.__select__ = select
   149         return copied
   150         return copied
   150 
   151 
   151     def tag_attribute(self, key, *args, **kwargs):
   152     def tag_attribute(self, key, *args, **kwargs):