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

Chris Withers chris at simplistix.co.uk
Thu Oct 20 05:54:53 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.

Oooh, coool. Reckon it'd be a good idea if I changed all the deprecation 
warnings in Zope to do the same?

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 ;-)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-CMF mailing list