cubicweb/rtags.py
branch3.25
changeset 12212 f2e6fb5ddf68
parent 11932 7b2247098f58
child 12567 26744ad37953
equal deleted inserted replaced
12211:1a5911825ef5 12212:f2e6fb5ddf68
    86                 'inconsistent class for parent rtag {0}'.format(parent)
    86                 'inconsistent class for parent rtag {0}'.format(parent)
    87 
    87 
    88     def __repr__(self):
    88     def __repr__(self):
    89         # find a way to have more infos but keep it readable
    89         # find a way to have more infos but keep it readable
    90         # (in error messages in case of an ambiguity for instance)
    90         # (in error messages in case of an ambiguity for instance)
    91         return '%s (%s): %s' % (id(self), self.__regid__, self.__class__)
    91         return '<%s %s>' % (self.__regid__, self._short_repr())
       
    92 
       
    93     def _short_repr(self):
       
    94         # find a way to have more infos but keep it readable
       
    95         # (in error messages in case of an ambiguity for instance)
       
    96         return '%s@0x%x%s' % (
       
    97             self.__module__, id(self),
       
    98             ' derived from %s' % self._parent._short_repr() if self._parent else '')
    92 
    99 
    93     # dict compat
   100     # dict compat
    94     def __getitem__(self, key):
   101     def __getitem__(self, key):
    95         return self.get(*key)
   102         return self.get(*key)
    96     __contains__ = __getitem__
   103     __contains__ = __getitem__