#8307: ImageFile doesn't use the width_field and height_field for cache
--------------------------------------------------+-------------------------
Reporter: [EMAIL PROTECTED] | Owner: jacob
Status: assigned | Milestone: 1.0
Component: File uploads/storage | Version: SVN
Resolution: | Keywords: imagefile
height width
Stage: Accepted | Has_patch: 1
Needs_docs: 1 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------------------+-------------------------
Comment (by Gulopine):
For the record, here are a few of the ways I know of that the two could
get out of sync:
* A bug in Django (as you mention) which shouldn't happen, but is still
possible
* Improperly using Django's API (as you mention) to cause a mismatch
* An admin or staff member could manually update a file directly, without
using Django
* A cron job could rename, resize or otherwise alter files
* An admin or staff member could manually update the database directly,
without using the model's `save()` method
* A monkeypatch (mistakenly or not) altered or removed the code to update
`width_field` and `height_field`
* A custom `ImageFile` subclass (mistakenly or not) sets the
`width_field` and `height_field` to the wrong values
* ... and the list goes on
As for the performance (and potentially monetary) hit when accessing
files, the `width` and `height` shouldn't be loaded when retrieving the
file; they only get populated when actually accessing them. If you find
they are in fact getting accessed every time regardless of whether they're
being used, that's a legitimate bug that should be filed separately.
I have no doubt that the attached patch works correctly for the behavior
you want. I'm just not sure it's the behavior Django should use.
--
Ticket URL: <http://code.djangoproject.com/ticket/8307#comment:8>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---