Example #1
0
def PUT_factory(self, name, typ, body):
    '''Creates ExtImage instead of plain Image.'''
    ct, w, h = getImageInfo(body)
    if ct:
        major, minor = string.split(ct, '/')
        if major == 'image':
            return ExtImage(name, '', '')
    major, minor = string.split(typ, '/')
    if major == 'image':
        return ExtImage(name, '', '')
    return None
Example #2
0
    def __init__(self, id, title, file, content_type='', precondition=''):
        try: id = id()
        except TypeError: pass

        self.__name__ = id
        self.title = title
        self.data = ''
        self.size = 0
        self.width = -1
        self.height = -1
        self.content_type = content_type
        self.precondition = precondition
        self._ext_file = ExtImage(id, title)
Example #3
0
def toExtImage(self, id, backup=0):
    '''Converts plain Image to ExtImage. 
	   Call this method in the Folder context and pass the id.
	   Must have threads, will not work in debugger!'''
    oldId = str(id)
    oldOb = self._getOb(oldId)
    newId = oldId + '___tmp'
    ximOb = ExtImage(oldId, oldOb.title)
    newId = self._setObject(newId, ximOb)
    newOb = self._getOb(newId)
    newOb.manage_http_upload(oldOb.absolute_url())
    newOb.content_type = oldOb.content_type
    if backup: self.manage_renameObjects([oldId], [oldId + '_bak'])
    else: self.manage_delObjects([oldId])
    self.manage_renameObjects([newId], [oldId])