From c921c5b8f9fdd20ea1b69079dce59d7b1afd18f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Mon, 22 Jul 2013 15:47:22 +0200 Subject: [PATCH] =?utf8?q?Enregistrement=20du=20nom=20original=20du=20fich?= =?utf8?q?ier=20dans=20=C2=AB=C2=A0orig=5Fname=C2=A0=C2=BB.=20=C3=89crasem?= =?utf8?q?ent=20de=20l'objet=20existant=20si=20r=C3=A9-upload.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Folder.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Folder.py b/Folder.py index ce440f1..c3ca6f7 100644 --- a/Folder.py +++ b/Folder.py @@ -321,7 +321,12 @@ 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) + else : + 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,11 +338,8 @@ 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) + ob.orig_name = fileName RESPONSE.setStatus(201) RESPONSE.setBody('') -- 2.20.1