le nom du fichier n'est pas perdu en cours d'édition

This commit is contained in:
fpeters 2004-04-04 17:29:37 +00:00
parent cd4d470eed
commit c86aa8225b
2 changed files with 8 additions and 3 deletions

View File

@ -137,6 +137,7 @@ class UploadFile(ObjectWebMixin, UploadFile):
self.data_kind = copy.copy(self.data_kind) # Deleted below.
self.data_kind.widget = copy.copy(slot.getWidget())
self.data_kind.widget.fileName = self.dataFileName
layout = X.array()
if self.dataType == 'application/vnd.sun.xml.writer':
try:
@ -148,6 +149,8 @@ class UploadFile(ObjectWebMixin, UploadFile):
layout += X.asIs(body)
except ImportError:
pass
except:
pass
layout += ObjectWebMixin.getViewLayout(
self, fields, parentSlot = parentSlot)
if self.dataFileName:
@ -205,7 +208,8 @@ class UploadFilesWeb(ObjectsWebMixin, UploadFilesProxy):
rememberObject(id)
if fileName and object.dataFileName != urllib.unquote(fileName):
pageNotFound()
return pageNotFound()
if not fileName and object.dataFileName:
uri = X.idUrl(id, 'download/%s' % object.dataFileName)
return redirect(uri)

View File

@ -1663,8 +1663,9 @@ class UploadFile(WidgetMixin, proxyWidgets.UploadFile):
def forgetLegacyUploadFile(self, slot, value):
v = commonTools.newThing('other', 'Upload')
if hasattr(self, 'fileName'):
v.dataFileName = self.fileName
fileNameSlot = slot.getContainer().getSlot(
slot.name + 'FileName', parentSlot = slot.parent)
v.dataFileName = fileNameSlot.getValue()
v.data = value
typeSlot = slot.getContainer().getSlot(
slot.name + 'Type', parentSlot = slot.parent)