[Zope] converting objects

Andy andy@agmweb.ca
Mon, 11 Jun 2001 21:09:05 -0700


Just for the record, heres a script I wrote to convert from DTML Method to
Document, using the same basic idea... if you find a way around it, let me
know.

http://www.zope.org/Members/andym/method_to_document

----- Original Message -----
From: "Matt" <matt@virtualspectator.com>
To: <zope@zope.org>
Sent: Monday, June 11, 2001 7:52 PM
Subject: [Zope] converting objects


> 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
>
>
> _______________________________________________
> 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 )
>