Re: [Zope] Cloning a ZClass-Instance
brocken22@gmx.de writes:
Hallo, 'news'is a zclass and when I'm using a hardcoded value for x it's working.
that's the cloning-method: ------------------------------ <dtml-in "objectValues(['news'])"> <dtml-let x=sequence-item>
<dtml-if "now.isCurrentDay()"> <dtml- call "manage_clone(_.getitem('x',0),'firstclone', [REQUEST])">
Copied! <dtml-else> Not needed to clone!! </dtml-if> </dtml-let> </dtml-in> ------------------------------ And the traceback: --------------- The object one does not support this operation Whereever you use a name in DTML, the referenced object is called, if it is callable.
In your case, you use the name "sequence-item" in the "dtml-let". Apparently, your "news" instances are callable. If I am right, then "x" is a string (which of cause does not support cloning). Try: <dtml-let x="_.getitem('sequence-item')"> .... </dtml-let> Dieter
Dear all, My problem is that : I have a ZClass based on OFS::File. I need to override the default index_html for my own purpose. After I created my own index_html, I found myself can't access the content of that object. Since: 1. I have no way to access the original method index_html of the base class 2. In OFS::File, There is no other method than index_html to access the content of this object. That's why I modify Image.py and add one line: getContent=index_html It's work for me. I don't think it's a good idea, since it's quick and dirty. Is there any better way to do this? Thanks Iap, Singuan
iap_y2fun.com writes:
My problem is that : I have a ZClass based on OFS::File. I need to override the default index_html for my own purpose. After I created my own index_html, I found myself can't access the content of that object. Since: 1. I have no way to access the original method index_html of the base class I, too, would wish that ZClasses provide access to overwritten methods (as Python does).
2. In OFS::File, There is no other method than index_html to access the content of this object. That's why I modify Image.py and add one line: getContent=index_html It's work for me. For file objects, you can use "str(data)".
It won't work with images, though. Dieter
participants (2)
-
Dieter Maurer -
iap_y2fun.com