# HG changeset patch # User Sylvain Thénault # Date 1253691336 -7200 # Node ID c6aff16e5aedf01a2313c513e4c3b77ad7318c93 # Parent 435286b8fe107b44410be7cb2048a7f1ecd21753 nicer warnings diff -r 435286b8fe10 -r c6aff16e5aed server/hook.py --- a/server/hook.py Wed Sep 23 09:35:28 2009 +0200 +++ b/server/hook.py Wed Sep 23 09:35:36 2009 +0200 @@ -137,14 +137,16 @@ @classproperty def __regid__(cls): - warn('[3.6] %s: please specify an id for your hook' % cls) + warn('[3.6] %s.%s: please specify an id for your hook' + % (cls.__module__, cls.__name__), DeprecationWarning) return str(id(cls)) @classmethod def __registered__(cls, vreg): super(Hook, cls).__registered__(vreg) if getattr(cls, 'accepts', None): - warn('[3.6] %s: accepts is deprecated, define proper __select__' % cls) + warn('[3.6] %s.%s: accepts is deprecated, define proper __select__' + % (cls.__module__, cls.__name__), DeprecationWarning) rtypes = [] for ertype in cls.accepts: if ertype.islower(): @@ -165,8 +167,9 @@ def __call__(self): if hasattr(self, 'call'): - warn('[3.6] %s: call is deprecated, implements __call__' % self.__class__, - DeprecationWarning) + cls = self.__class__ + warn('[3.6] %s.%s: call is deprecated, implements __call__' + % (cls.__module__, cls.__name__), DeprecationWarning) if self.event.endswith('_relation'): self.call(self._cw, self.eidfrom, self.rtype, self.eidto) elif 'delete' in self.event: diff -r 435286b8fe10 -r c6aff16e5aed vregistry.py --- a/vregistry.py Wed Sep 23 09:35:28 2009 +0200 +++ b/vregistry.py Wed Sep 23 09:35:36 2009 +0200 @@ -61,7 +61,8 @@ def class_regid(cls): """returns a unique identifier for an appobject class""" if 'id' in cls.__dict__: - warn('%s: id is deprecated, use __regid__') + warn('%s.%s: id is deprecated, use __regid__' + % (cls.__module__, cls.__name__), DeprecationWarning) cls.__regid__ = cls.id if hasattr(cls, 'id'): return cls.id