[Zope-CMF] Re: Better DeprecationWarnings (was Re: SVN:
CMF/trunk/CMFDefault/Portal.py
- reverted Portal.py change of r39125 to fix BBB temporarily)
Florent Guillaume
fg at nuxeo.com
Wed Oct 19 12:24:13 EDT 2005
Tres Seaver wrote:
> Note that I have just figured out that we can make DeprecationWarnings
> more useful by passing the 'stacklevel' argument to 'warnings.warn';
> passing a value of 2 for that argument causes the warning to be reported
> against the *caller* of the code issuing the warning, which makes it
> possible to find and remove the deprecated use.
Yes, I've changed a number of those in Zope and CMF already. It's very
useful for deprecation.
Note that I prefer passing the stacklevel=2 (or 3) argument by name to be
explicit.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope-CMF
mailing list