[Zope] manage_edit and manage_upload Image object

Nico de Boer nico@nfg.nl
28 May 2002 17:15:53 +0200


Hi all,

I'm working on a product that uses Image.py as superclass.

In the Image object are two seperate methods used: one for 
manage_edit and one for manage_upload. I want to merge the 
manage_upload method into my manage_edit method, so I don't 
need to use two seperate forms for my Edit form.

I have a problem when I change the alignment of the object.
When I now Save the Changes, the image data is lost.

This is my manage_edit code:

    def manage_edit(self, file='', menu='', title='', subtitle='', lead='',
                    body='', border='', align='', height='', width='',
                    content_type='', precondition='', REQUEST=None):
        """
        Edits content of the Ingezonden Mededeling
        """
        self.menu = string.strip(menu)
        self.title = string.strip(title)
        self.subtitle = subtitle
        self.lead = string.strip(lead)
        self.body = string.strip(body)
	self.border = border
        self.align = align
	self.height = height
	self.width = width
        self.content_type = content_type
        self.precondition = precondition
        data, size = self._read_data(file)
        content_type=self._get_content_type(file, data, self.__name__, content_type)
        self.update_data(data, content_type, size)
        if precondition:
            self.precondition = str(precondition)
        elif self.precondition:
            del self.precondition
        if REQUEST:
            message= "Wijzigingen bewaard."
            return self.manage_main(self, REQUEST, manage_tabs_message=message)
 
Can you check if there is any file data? I have tried this, but it
doesn't work:

        if file is not None:
                data, size = self._read_data(file)
                content_type=self._get_content_type(file, data, self.__name__, content_type)
                self.update_data(data, content_type, size)

Can someone help me, otherwise I have to split up the form.

Thanks,

Greetz Nico