[Zope-dev] problems setting up methods for a product that registers no classes

Dieter Maurer dieter at handshake.de
Thu Sep 29 14:10:05 EDT 2005


Chris Withers wrote at 2005-9-29 09:17 +0100:
>...zdb in this case.
>
>I need to make a "global recompile" function available, since zdb 
>requires the co_filename attribute of the script's func_code object to 
>be set to something meaningful, rather than the useless "Script 
>(Python)" it usually gets set to.
> ...
>Now, this breaks in 2.8, so what SHOULD I be doing to make a method 
>globally available in a way that works in both 2.7 and 2.8?

You could use part of the old style initialization, the "methods"
declaration to be precise.

You see an example in ".../Products/ZSQLMethods/__init__.py".

Be warned, however: the old style initialization puts
the declared methods on the "OFS.Folder" class.

Thus, you better choose a name that is unlikely to conflict
with other methods that might be relevant for classes
derived from "Folder"...

-- 
Dieter


More information about the Zope-Dev mailing list