Logo Search packages:      
Sourcecode: zope-photo version File versions  Download package

def zope-photo-1.2.4::Photo::Photo::PUT (   self,
  REQUEST,
  RESPONSE 
)

Handle HTTP PUT requests.

Definition at line 456 of file Photo.py.

00456                                     :
        """Handle HTTP PUT requests."""
        self.dav__init(REQUEST, RESPONSE)
        if hasattr(self, 'dav__simpleifhandler'):
            self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
        file=REQUEST['BODYFILE']
        
        if hasattr(self, '_original'):
            # Updating existing Photo
            self._original.manage_upload(file, self.content_type())
            if self._validImage():
                self._makeDisplayPhotos()
        else:
            # Adding a new Photo.
            # In Zope 2.7.3 and before, the object is not yet in its final
            # context. Since ExtImage needs to know the URL of the new Photo
            # object so it can determine where to create new files, we store
            # the image data and let manage_afterAdd() generate the displays
            # once the Photo is in its final context.
            self._data = file.read()

            # Zope 2.7.4 and after does _setObject before calling this PUT(),
            # so we can do all the work now.
            if self.absolute_url(1):
                store = self.propertysheets.get('photoconf').getProperty('store')
                if store == 'Image': from PhotoImage import PhotoImage
                elif store == 'ExtImage': from ExtPhotoImage import PhotoImage
                self._original = PhotoImage(self.id, self.title, path=self.absolute_url(1))
                self._original.manage_upload(StringIO(self._data), self.content_type())
                delattr(self, '_data')
                if self._validImage():
                    self._makeDisplayPhotos()
            
        RESPONSE.setStatus(204)
        return RESPONSE

    security.declareProtected('FTP access', 'manage_FTPget', 'manage_FTPstat', 'manage_FTPlist')
    def manage_FTPget(self):


Generated by  Doxygen 1.6.0   Back to index