ZClasses not copyable - why?
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: 0. Why are ZClasses not copyable? 1. Do I shoot into my foot with my hack or is that OK? ----------------------------- 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. in ZClass I have found a nice-sounding method _setBasesHoldOnToYourButts() <grin>, and the source is commented with '#Eeeek', hmmmm What are the risks for a good shot into my foot using this function? thanks phil
Philipp Auersperg wrote:
in ZClass I have found a nice-sounding method _setBasesHoldOnToYourButts() <grin>, and the source is commented with '#Eeeek', hmmmm
What are the risks for a good shot into my foot using this function?
If your new base classes requires some variables to be initialized in __init__, older instances may not work since they won't have them, and other similar problems. I've done this before, when I really had to - usually nothing bad happens. -- Itamar S.T. itamar@maxnm.com Fingerprint = D365 7BE8 B81E 2B18 6534 025E D0E7 92DB E441 411C
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
I'd like to be able to nest footers and headers. The thing I would expect is to have a standard_html_footer DTML method in the root, then be able to have standard_html_footers in subfolders which add their stuff, then call the root one. like: /standard_html_footer: (c) 2000 Warner Brothers /merrie_melodies/standard_html_footer: That's all folks! <dtml-var standard_html_footer> Of course this causes infinite recursion now. So is there a decent way to explicitly call the "super" standard_html_footer, without renaming files or copying data in multiple places? -- Neil Kandalgaonkar <NeilK@ActiveState.com> Web Application Developer, ActiveState
participants (4)
-
Itamar Shtull-Trauring -
Michel Pelletier -
Neil K -
Philipp Auersperg