Python base class for ZClass.
Hello, all. I'm in the process of developing some ZClasses for a project we're working on. I am very familiar with the restrictions on changing the base class(es) of a ZClass, and would like to follow Michel Pelletier's (and other's) recommendation of having a Python base class for my ZClass. I know how to do it. I have gotten it working. However, I can't figure out how to structure my directory tree satisfactorily. Logically, both the Python base class and its associated ZClasses are part of one Product (at least, in my head they are.) However, I'm not so sure this is true when it comes to implementation. Products added through the Control Panel (for storing ZClasses) do not make a directory in lib/python/Products. So, I figured I could place my python base class in lib/python/Shared/GV. Once I've done that, my base class is accessible anywhere in Zope. Cool. Now I just need to register it as a base for ZClasses. So, I make a directory lib/python/Products/MyProduct. In this directory, I put an __init__.py with: import MyBasePythonClass def initialize(context): context.registerBaseClass(MyBasePythonClass.MyBasePythonClass) So, now my class is available as a base class for my ZClass. Now, it's time to make the ZClass. But, where? Is it considered bad form to add it in the MyProduct product (a "closed box" product)? Should I make another product, an "open box" one through the Control Panel, called MyProduct2 and make my ZClass in there? If that's the case, I might as well take MyBasePythonClass out of lib/python/Shared/GV and put it in a "closed box" product called MyProductBase, and then make the ZClasses in the "open box" MyProduct. Boy, that was a mouthful. :) Basically, it all boils down to: Of those of you who are using Python base classes for your ZClass, how are you structuring your product/directory tree? --Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
participants (1)
-
Jeff K. Hoffman