Opened 18 years ago

Closed 18 years ago

Last modified 18 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

Description

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@… 18 years ago.

Download all attachments as: .zip

Change History (3)

by tom@…, 18 years ago

Attachment: get_file_size.diff added

comment:1 by tom@…, 18 years ago

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/functional.py", 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/base.py", 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 by Malcolm Tredinnick, 18 years ago

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