Is it possible to use a ZClass as a base for a Python Class?
I have a lot of ZSQL Methods stored in a ZClass and I am wondering if it is possible to somehow import this ZClass and use its methods in a Python Class... I've seen lots about using a Python Class as the Base for a ZClass, but nothing for the other way around.... Anyone know how to do it? WPH
Bill Hewitt wrote at 2004-9-10 19:36 -0700:
I have a lot of ZSQL Methods stored in a ZClass and I am wondering if it is possible to somehow import this ZClass and use its methods in a Python Class... I've seen lots about using a Python Class as the Base for a ZClass, but nothing for the other way around....
It may be possible -- but if it is, it will be quite difficult: "ZClasses" live in the ZODB. Many Python modules are imported before a ZODB connection is opened. This makes it difficult for them to access the ZODB. If you can delay the creation of your Python class until you can access the ZODB, it may be possible. See "Zope.App.ClassFactory.ClassFactory" how to access a ZClass provided you have a ZODB connection. -- Dieter
participants (2)
-
Bill Hewitt -
Dieter Maurer