Ticket #7586 (new Feature Request)
FileField.getFilename very unefficient
| Reported by: | zegor | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | Future |
| Component: | Archetypes | Keywords: | FileField blobs |
| Cc: |
Description
(Moved from http://dev.plone.org/archetypes/ticket/747)
FileField.getFilename by default calls getBaseUnit to get the filename. getBaseUnit recalls FileField.getFilename with fromBaseUnit to false to get the filename ! After, it creates an BaseUnit and loads the file content into memory (value.data). With big files, it's very slow and consummes a lot of RAM for nothing. After all this work, BaseUnit.getFilename is called.
This is very complex and unefficient ! Why FileField.getFilename needs to create a baseUnit only to get a filename that is got finally from itself ?
I suggest to put fromBaseUnit to False by default in FileField.getFilename or to desactivate this parameter. def getFilename(self, instance, fromBaseUnit=True) => def getFilename(self, instance, fromBaseUnit=False)
I use Plone 3.0 final the same behavior with Archetypes 1.3.x.
