[Zope-dev] ZClasses not copyable - why?
Michel Pelletier
michel@digicool.com
Mon, 06 Nov 2000 10:04:04 -0800
Philipp Auersperg wrote:
>
> It is not posible to copy ZClasses, when I try to copy a ZClass
> in the Management Interface I get the error: 'The Item 'blorf' does not support that operation'
>
> I digged into that and found that in the ZClass.py there exists a method
>
> def cb_isCopyable:
> pass
>
> I was so crude to replace the pass with a 'return 1', restarted Zope and
> could now copy ZClasses as I wanted it.
>
> -----------------------------
> My first question now:
(zero indexed questions, I love it)
> 0. Why are ZClasses not copyable?
I don't know.
> 1. Do I shoot into my foot with my hack or is that OK?
I don't know, but I suspect you're aiming the gun in that general
direction.
> -----------------------------
>
> And now my second question
> I am working on a ZClass-intensive project and sometimes I
> want to add/remove base classes of a ZClass without redefining the whole class manually.
The usual method for this is to subclass from a class you define in
Python, then you can change the base classes of that python class
easily. For this you need to make a python product with your class in
it and initialize the product, registering the class as subclassable.
There's probably a how-to on it somewhere, otherwise you can check out
lib/python/Products/ZCatalog/__init__.py to see how the ZCatalog class
is made ZClass subclassable.
-Michel