Inheriting Image Classes in ZClasses?
Hi All, First of all, I'd like to thank everyone who helped me with my auto-cataloging thing. That is working beautifully now. Onto my new problem. I am trying to set up an image subclass for a particular project that I am on. As well as the normal image properties, it has things like alt, display height, copyright, etc. I've set up a ZClass called OPImage. The problem I am having is actually defining it to be a subclass. I can add items matching this class, but whenever I go to edit them, it brings me up to the standard image edit, which, of course, ignores all of the new properties I have set. I have my own edit form set up as the first option in the views tag for the propertysheets for this class. The code I have for adding an item of this class is: <dtml-with expr="REQUEST.form"> <dtml-call "manage_addImage(objectname, file, title=thetitle)"> <dtml-with "_.getitem(_['objectname'])"> <dtml-call "manage_addProperty('alt', alttag, 'string')"> <dtml-if expr="dheight == ''"> <dtml-call "manage_addProperty('dheight', height, 'string')"> <dtml-else> <dtml-call "manage_addProperty('dheight', dheight, 'string')"> </dtml-if> <dtml-if expr="dwidth == ''"> <dtml-call "manage_addProperty('dwidth', width, 'string')"> <dtml-else> <dtml-call "manage_addProperty('dwidth', dwidth, 'string')"> </dtml-if> </dtml-with> </dtml-with> (If there is something awful there, please let me know as I am new to Zope) It is pretty obvious to me that the manage_addImage is causing the problem, but I can't work out how else to set it, or how exactly I define this to be a subclass of the Image class. I've looked through the archives, and can see it CAN be done, but no hints as to how. Help! Thanks very much Di
I'd start by looking at the code in Control_Panel/Products/OPImage/OPImage_add (I'm assuming that your product has the same name as your ZClass.) This is the method that is called from the default form that is used to create an instance of your class (called OPImage_addForm). You will also want to uncomment this line: <dtml-call "propertysheets.Basic.manage_editProperties( REQUEST)"> If you want to create them programmatically (as opposed to using the management form always), look at http://www.zope.org/Members/tazzzzz/addZClasses -Paul Dianne Van Dulken wrote:
Hi All,
First of all, I'd like to thank everyone who helped me with my auto-cataloging thing. That is working beautifully now.
Onto my new problem. I am trying to set up an image subclass for a particular project that I am on. As well as the normal image properties, it has things like alt, display height, copyright, etc.
I've set up a ZClass called OPImage. The problem I am having is actually defining it to be a subclass. I can add items matching this class, but whenever I go to edit them, it brings me up to the standard image edit, which, of course, ignores all of the new properties I have set. I have my own edit form set up as the first option in the views tag for the propertysheets for this class.
The code I have for adding an item of this class is:
<dtml-with expr="REQUEST.form"> <dtml-call "manage_addImage(objectname, file, title=thetitle)"> <dtml-with "_.getitem(_['objectname'])"> <dtml-call "manage_addProperty('alt', alttag, 'string')"> <dtml-if expr="dheight == ''"> <dtml-call "manage_addProperty('dheight', height, 'string')"> <dtml-else> <dtml-call "manage_addProperty('dheight', dheight, 'string')"> </dtml-if> <dtml-if expr="dwidth == ''"> <dtml-call "manage_addProperty('dwidth', width, 'string')"> <dtml-else> <dtml-call "manage_addProperty('dwidth', dwidth, 'string')"> </dtml-if> </dtml-with> </dtml-with>
(If there is something awful there, please let me know as I am new to Zope)
It is pretty obvious to me that the manage_addImage is causing the problem, but I can't work out how else to set it, or how exactly I define this to be a subclass of the Image class. I've looked through the archives, and can see it CAN be done, but no hints as to how.
Help!
Thanks very much
Di
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Dianne Van Dulken writes:
Onto my new problem. I am trying to set up an image subclass for a particular project that I am on. As well as the normal image properties, it has things like alt, display height, copyright, etc.
I've set up a ZClass called OPImage. The problem I am having is actually defining it to be a subclass. I can add items matching this class, but whenever I go to edit them, it brings me up to the standard image edit, Define your own editing form as a method of your ZClass and use it in the ZClass' "View" tab.
Dieter
participants (3)
-
Dianne Van Dulken -
Dieter Maurer -
Paul Erickson