diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-07-07 23:16:00 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-07-07 23:16:00 +0000 |
| commit | a28b75b0ba9650ae3bd46e38d12d95d48f5c5664 (patch) | |
| tree | 60084232ace3608e32c9f15987263795f0592265 /tests/regressiontests | |
| parent | 9dabd1f8ff7760f28bd1dcfa8b83ae6b1c0b79aa (diff) | |
Fixed #7614: the quickening has come, and there now is only one UploadedFile. On top of that, UploadedFile's interface has been improved:
* The API now more closely matches a proper file API. This unfortunately means a few backwards-incompatible renamings; see BackwardsIncompatibleChanges. This refs #7593.
* While we were at it, renamed chunk() to chunks() to clarify that it's an iterator.
* Temporary uploaded files now property use the tempfile library behind the scenes which should ensure better cleanup of tempfiles (refs #7593 again).
Thanks to Mike Axiak for the bulk of this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/file_uploads/views.py | 6 | ||||
| -rw-r--r-- | tests/regressiontests/forms/fields.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/regressiontests/file_uploads/views.py b/tests/regressiontests/file_uploads/views.py index dfa877da3a..c45f6a609f 100644 --- a/tests/regressiontests/file_uploads/views.py +++ b/tests/regressiontests/file_uploads/views.py @@ -15,7 +15,7 @@ def file_upload_view(request): if isinstance(form_data.get('file_field'), UploadedFile) and isinstance(form_data['name'], unicode): # If a file is posted, the dummy client should only post the file name, # not the full path. - if os.path.dirname(form_data['file_field'].file_name) != '': + if os.path.dirname(form_data['file_field'].name) != '': return HttpResponseServerError() return HttpResponse('') else: @@ -29,7 +29,7 @@ def file_upload_view_verify(request): form_data.update(request.FILES) # Check to see if unicode names worked out. - if not request.FILES['file_unicode'].file_name.endswith(u'test_\u4e2d\u6587_Orl\xe9ans.jpg'): + if not request.FILES['file_unicode'].name.endswith(u'test_\u4e2d\u6587_Orl\xe9ans.jpg'): return HttpResponseServerError() for key, value in form_data.items(): @@ -51,7 +51,7 @@ def file_upload_echo(request): """ Simple view to echo back info about uploaded files for tests. """ - r = dict([(k, f.file_name) for k, f in request.FILES.items()]) + r = dict([(k, f.name) for k, f in request.FILES.items()]) return HttpResponse(simplejson.dumps(r)) def file_upload_quota(request): diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py index 4725c3ecf3..f266e7bc50 100644 --- a/tests/regressiontests/forms/fields.py +++ b/tests/regressiontests/forms/fields.py @@ -800,10 +800,10 @@ Traceback (most recent call last): ValidationError: [u'The submitted file is empty.'] >>> type(f.clean(SimpleUploadedFile('name', 'Some File Content'))) -<class 'django.newforms.fields.UploadedFile'> +<class 'django.core.files.uploadedfile.SimpleUploadedFile'> >>> type(f.clean(SimpleUploadedFile('name', 'Some File Content'), 'files/test4.pdf')) -<class 'django.newforms.fields.UploadedFile'> +<class 'django.core.files.uploadedfile.SimpleUploadedFile'> # URLField ################################################################## |
