typ, enc=guess_content_type(validId, body)
if self.checkIdAvailable(validId) :
- ob = self.PUT_factory(validId, typ, body)
- self._setObject(validId, ob)
- ob = self._getOb(validId)
+ try :
+ ob = self.PUT_factory(validId, typ, body)
+ self._setObject(validId, ob)
+ ob = self._getOb(validId)
+ except ValueError : # maybe "Disallowed subobject type". Fallback to file type.
+ validId = self.invokeFactory('File', validId)
+ ob = self._getOb(validId)
if IDublinCore.providedBy(ob) :
ob.editMetadata(title=fileName,
format=typ)
# get method from container that receive uploaded content
ti = self.getTypeInfo()
method_id = ti.queryMethodID('jsupload_snippet')
- meth = getattr(self, method_id) if method_id else lambda : 'Not implemented'
+ meth = getattr(self, method_id) if method_id else lambda ob : 'Not implemented'
RESPONSE.setStatus(httpRespCode)
RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')