view.py
changeset 8666 1dd655788ece
parent 8425 b86bdc343c18
child 8941 7b26fe71404f
equal deleted inserted replaced
8665:e65af61bde7d 8666:1dd655788ece
    24 from cStringIO import StringIO
    24 from cStringIO import StringIO
    25 from warnings import warn
    25 from warnings import warn
    26 from functools import partial
    26 from functools import partial
    27 
    27 
    28 from logilab.common.deprecation import deprecated
    28 from logilab.common.deprecation import deprecated
    29 from logilab.common.registry import classid, yes
    29 from logilab.common.registry import yes
    30 from logilab.mtconverter import xml_escape
    30 from logilab.mtconverter import xml_escape
    31 
    31 
    32 from rql import nodes
    32 from rql import nodes
    33 
    33 
    34 from cubicweb import NotAnEntity
    34 from cubicweb import NotAnEntity
   606         def decorated(self, *args, **kwargs):
   606         def decorated(self, *args, **kwargs):
   607             entity = self.entity
   607             entity = self.entity
   608             if hasattr(entity, func.__name__):
   608             if hasattr(entity, func.__name__):
   609                 warn('[3.9] %s method is deprecated, define it on a custom '
   609                 warn('[3.9] %s method is deprecated, define it on a custom '
   610                      '%s for %s instead' % (func.__name__, iface,
   610                      '%s for %s instead' % (func.__name__, iface,
   611                                             classid(entity.__class__)),
   611                                             entity.__class__),
   612                      DeprecationWarning)
   612                      DeprecationWarning)
   613                 member = getattr(entity, func.__name__)
   613                 member = getattr(entity, func.__name__)
   614                 if callable(member):
   614                 if callable(member):
   615                     return member(*args, **kwargs)
   615                     return member(*args, **kwargs)
   616                 return member
   616                 return member