Ticket #7586 (new Feature Request)

Opened 4 years ago

Last modified 2 years ago

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.

Change History

comment:1 Changed 4 years ago by davethewebb

  • Reporter changed from davethewebb to zegor

comment:2 Changed 4 years ago by hannosch

  • Milestone set to 3.0.x

comment:3 Changed 4 years ago by hannosch

  • Type changed from Bug to Enhancement
  • Milestone changed from 3.x to Future

That whole part of Archetypes is indeed very suboptimal. We might get some improvements in the area when moving to blobs.

comment:4 Changed 2 years ago by witsch

  • Keywords blobs added

also something to revisit soonish...

Note: See TracTickets for help on using tickets.