Logo Search packages:      
Sourcecode: zope-extfile version File versions

def zope-extfile-1.4.2::ExtFile::ExtFile::PUT (   self,
  REQUEST,
  RESPONSE 
)

Handle HTTP PUT requests 

Definition at line 459 of file ExtFile.py.

00459                                     :
        """ Handle HTTP PUT requests """
        self.dav__init(REQUEST, RESPONSE)
        self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
        file = REQUEST['BODYFILE']
        content_type = REQUEST.get_header('content-type', None)
        if content_type:
            file = HTTPUpload(file, content_type)
        self.content_type = self._get_content_type(file, file.read(100),
                            self.id, self.content_type)
        file.seek(0)
        self._register()    # Register with TM
        try:
            # Need to pass in the path as webdav.NullResource calls PUT
            # on an unwrapped object.
            try:
                self.aq_parent # This raises AttributeError if no context
            except AttributeError:
                path = self._get_zodb_path(REQUEST.PARENTS[0])
            else:
                path = None
            new_fn = self._get_ufn(self.filename, path=path)
            self._update_data(file, self._temp_fsname(new_fn))
        finally: self._dir__unlock()
        self.filename = new_fn
        self._afterUpdate()
        RESPONSE.setStatus(204)
        return RESPONSE
    
    security.declareProtected('FTP access', 'manage_FTPstat')
    security.declareProtected('FTP access', 'manage_FTPlist')


Generated by  Doxygen 1.6.0   Back to index