[Zope-CMF] Better DeprecationWarnings (was Re: SVN: CMF/trunk/CMFDefault/Portal.py - reverted Portal.py change of r39125 to fix BBB temporarily)

Tres Seaver tseaver at palladion.com
Thu Oct 20 11:05:26 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Withers wrote:
> 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.
> 
> 
> Oooh, coool. Reckon it'd be a good idea if I changed all the deprecation
> warnings in Zope to do the same?

+10.

> I've always found them totally useless 'cos they don't tell you where
> they come from and so you can't fix them...
> 
> Bit like the random ZODB errors when it no longer has the class for some
> long-forgotten object burried deep in an opaque pickled data structure
> which you have no hope of ever finding and deleting... but I digress ;-)

Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDV7I2+gerLs4ltQ4RAiTPAJ9ARNJ9C33+BrFMfD7bIgoMNSryQACgtGc5
nzgXeHE9NTZ79BQ5dF9rkN8=
=B+U3
-----END PGP SIGNATURE-----


More information about the Zope-CMF mailing list