[Zope-dev] Deprecate ITerms in zope.app.form? [Re: zope.browser?]

Brian Sutherland brian at vanguardistas.net
Wed Dec 17 05:13:46 EST 2008


On Tue, Dec 16, 2008 at 03:45:01PM -0500, Tres Seaver wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Martijn Faassen wrote:
> > Christian Zagrodnick wrote:
> > [snip]
> >> Nope. http://mail.zope.org/pipermail/zope3-dev/2007-August/023223.html
> > 
> > Weird. At first glance I do not understand the context of that decision. 
> >   There was a decision to "avoid deprecation" made by it doesn't seem to 
> > be motivated in the discussion:
> > 
> > "- zope.app.component.interfaces then can import ISite from the new
> > place to avoid deprectation."
> > 
> > You're saying, I think, that we should do the same thing as in that 
> > discussion to avoid deprecation too. But I cannot find a reason to avoid 
> >   deprecation in the original discussion. Could you elaborate on your 
> > thinking?
> > 
> > I'm hoping to soon go through quite a few packages and deprecate lots of 
> > stuff by moving it into other packages to try to tidy up the dependency 
> > structure. If there are important arguments against deprecation warnings 
> > I'd like to understand the background.
> 
> One issue is that adding deprecation messages for importing symbols from
> the old makes all "downstream" code add ugly BBB warts in order to
> suppress them when run against multiple versions.

This is my issue as well.

http://docs.python.org/library/warnings.html#module-warnings

We could use PendingDeprecationWarning for recently deprecated code and
then convert that to DeprecationWarning once an alternative has been
available for some time.

That way, people like Roger would be able to get all recent deprecation
warnings by using the -Wd command line option to python, but they
wouldn't be shown by default.

    # python2.4 -Wd
    >>> import warnings
    >>> warnings.warn("deprecated", PendingDeprecationWarning)
    __main__:1: PendingDeprecationWarning: deprecated

    # python2.4    
    >>> import warnings
    >>> warnings.warn("deprecated", PendingDeprecationWarning)

There's probably some caveat as to why this won't work, but it seems
like it should by looking at the documentation.

-- 
Brian Sutherland


More information about the Zope-Dev mailing list