[Zope] converting objects

Matt matt@virtualspectator.com
Tue, 12 Jun 2001 14:52:49 +1200


The following is an external method I wrote for converting an
object(presumably a file object) into an Image.  It works fine, but seems a
scary way of doing it, i.e. deleteing the object that the method is
currently working on.  I was hoping there was a method that lets you reset
the object ... eg : self._setObject(new_image_object) instead of making a
new one and deleting the old one.

def convert_it(self,REQUEST):
    """convert to image"""
    new_id = self.id()
    new_title = self.title
    temp_data = self.data
    REQUEST.PARENTS[1].manage_delObjects(self.id())
    REQUEST.PARENTS[1].manage_addImage(new_id,temp_data,new_title)

    return "thanks"

regards
Matt