From: Benoît Pin Date: Mon, 22 Jul 2013 13:47:22 +0000 (+0200) Subject: Enregistrement du nom original du fichier dans « orig_name ». Écrasement de l'objet... X-Git-Url: https://svn.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/c921c5b8f9fdd20ea1b69079dce59d7b1afd18f1?ds=inline Enregistrement du nom original du fichier dans « orig_name ». Écrasement de l'objet existant si ré-upload. --- 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('')