X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/9cf1680587dbad588b3f8657b545c65e0aa601dc..38be86f2f98073dafe8450220f250eccd8f5f827:/Folder.py?ds=sidebyside diff --git a/Folder.py b/Folder.py index ce440f1..2458bf1 100644 --- a/Folder.py +++ b/Folder.py @@ -321,7 +321,14 @@ class PlinnFolder(CMFCatalogAware, PortalFolder, DefaultDublinCoreImpl) : if typ is None: typ, enc=guess_content_type(validId, body) - ob = self.PUT_factory(validId, typ, body) + if self.checkIdAvailable(validId) : + ob = self.PUT_factory(validId, typ, body) + self._setObject(validId, ob) + ob = self._getOb(validId) + httpRespCode = 201 + else : + httpRespCode = 200 + ob = self._getOb(validId) # We call _verifyObjectPaste with verify_src=0, to see if the # user can create this type of object (and we don't need to @@ -333,15 +340,16 @@ class PlinnFolder(CMFCatalogAware, PortalFolder, DefaultDublinCoreImpl) : (ob.__class__, repr(self), sys.exc_info()[1],) raise Unauthorized, sMsg - # Delegate actual PUT handling to the new object, - # SDS: But just *after* it has been stored. - self._setObject(validId, ob) - ob = self._getOb(validId) ob.PUT(REQUEST, RESPONSE) - - RESPONSE.setStatus(201) - RESPONSE.setBody('') - return RESPONSE + ob.orig_name = fileName + + + ti = ob.getTypeInfo() + method_id = ti.queryMethodID('jsupload_snippet') + meth = method_id and getattr(ob, method_id) or (lambda : 'Not implemented') + RESPONSE.setStatus(httpRespCode) + RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8') + return '%s>' % meth().strip() # ## overload to maintain ownership if authenticated user has 'Manage portal' permission