X-Git-Url: https://svn.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/9cf1680587dbad588b3f8657b545c65e0aa601dc..2707b39eef0714a12912f38eac62633aeb691f6f:/Folder.py?ds=sidebyside diff --git a/Folder.py b/Folder.py index ce440f1..9853b7b 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 '' % meth() # ## overload to maintain ownership if authenticated user has 'Manage portal' permission