Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1858 closed defect (fixed)

[patch] typo in get_FOO_size

Reported by: tom@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


the magic accessor to get the size of an uploaded file is broken. Trivial patch.

Attachments (1)

get_file_size.diff (514 bytes) - added by tom@… 12 years ago.

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by tom@…

Attachment: get_file_size.diff added

comment:1 Changed 12 years ago by tom@…

Sorry, I did't really demonstrate the problem. The magic 'get_FOO_size' accessor is broken. A call to 'get_file_size' in a test model throws

  File "/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/utils/", line 3, in _curried
    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))
  File "/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/db/models/", line 301, in _get_FIELD_size
    return os.path.getsize(self.__get_FIELD_filename(field))
AttributeError: 'Upload' object has no attribute '_Model__get_FIELD_filename'

I'd like to test this case, but I presume this will require a writable MEDIA_ROOT for the test suite, which seems like a large requirement to me.

comment:2 Changed 12 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [2903]) Fixed #1858 : typo in get_FIELD_size() method. Thanks, tom@….

Note: See TracTickets for help on using tickets.
Back to Top