Chris Withers wrote:
> Philipp von Weitershausen wrote:
> > This would probably best be handled by one person, so if you are willing to 
> > do all
> > the grepping and updating, making zLOG deprecated would just be a minor 
> > operation :).
> ...but one i don't know how to perform. What code would I insert and where?

See below :). Of course, you don't have to deprecate zLOG instantly. Removing 
all of its
references could already be done now.

> I'm happy to sign up for this, but can't promise when it'll happen...

So let's schedule it for Zope 2.10 then :).

> > In zLOG.LOG one would call warnings.warn()
> Ah, okay :-)

A typical call to warnings.warn() looks like this::

  warnings.warn("This is deprecated, dude", DeprecationWarning, stacklevel=2)

The stacklevel=2 is important because the deprecation warning "traceback" 
wouldn't point
to the offending code otherwise.

> > and the custom zLOG logging level constants could
> > be wrapped in a deprecation warnings (zope.deprecation.deprecate)
> How would I do this? Can you give me an example?

Use the doctests, Luke :). Anyway, here's an example:

It shows how to wrap stuff in deprecation proxies using 
zope.deprecation.deprecate(). Then
any access to these objects (e.g. importing) will trigger a warning. It also 
how to temporarily turn off those deprecation warnings, for example when you're 
deprecated stuff for internal use, such as still supporting old import 
locations (as in
this case).


This message was sent using IMP, the Internet Messaging Program.
Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to