Review Board

beta

Improve file uploading on newer Djangos.

Submitted
Updated 3 months, 3 weeks ago

Christian Hammond Reviewers
trunk reviewboard
None Review Board SVN
Migrate file uploading support to use the newer ImageField and FileField, as well as the new uploading classes in Django. This ends up cleaning up our code a little bit.

We also now upload images to /year/month/day directories.

This also changes unit tests to write files to a temporary directory so we don't litter the actual upload directory.
Verified that I could still upload diffs and images without problems. Also verified that the internal validation of correct image types works.

This passed all unit tests (well, as well as it did before -- there's some issue with writing 0-byte images to disk, and I think it's a Django bug. Still investigating.)
Ship it!
Posted 4 months, 1 week ago (July 13th, 2008, 5:34 p.m.)
This looks good.  I'm assuming these changes won't break already-uploaded screenshots?
/trunk/reviewboard/reviews/forms.py (Diff revision 2)
1
import re
1
import re
2
import os.path
Alphabetical, please.