From ef48a3e69c02438db32f20531f5c679e8315d528 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Sun, 10 Aug 2008 21:10:47 +0000 Subject: Fixed #7830 -- Removed all of the remaining, deprecated, non-oldforms features: * Support for representing files as strings was removed. Use `django.core.files.base.ContentFile` instead. * Support for representing uploaded files as dictionaries was removed. Use `django.core.files.uploadedfile.SimpleUploadedFile` instead. * The `filename`, `file_name`, `file_size`, and `chuck` properties of `UploadedFile` were removed. Use the `name`, `name`, `size`, and `chunks` properties instead, respectively. * The `get_FIELD_filename`, `get_FIELD_url`, `get_FIELD_size`, and `save_FIELD_file` methods for Models with `FileField` fields were removed. Instead, use the `path`, `url`, and `size` attributes and `save` method on the field itself, respectively. * The `get_FIELD_width` and `get_FIELD_height` methods for Models with `ImageField` fields were removed. Use the `width` and `height` attributes on the field itself instead. * The dispatcher `connect`, `disconnect`, `send`, and `sendExact` functions were removed. Use the signal object's own `connect`, `disconnect`, `send`, and `send` methods instead, respectively. * The `form_for_model` and `form_for_instance` functions were removed. Use a `ModelForm` subclass instead. * Support for importing `django.newforms` was removed. Use `django.forms` instead. * Support for importing `django.utils.images` was removed. Use `django.core.files.images` instead. * Support for the `follow` argument in the `create_object` and `update_object` generic views was removed. Use the `django.forms` package and the new `form_class` argument instead. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8291 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/forms/fields.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'django/forms/fields.py') diff --git a/django/forms/fields.py b/django/forms/fields.py index 47ae5e11b2..f3e5528f23 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -442,16 +442,7 @@ class FileField(Field): elif not data and initial: return initial - if isinstance(data, dict): - # We warn once, then support both ways below. - import warnings - warnings.warn( - message = "Representing uploaded files as dictionaries is deprecated. Use django.core.files.uploadedfile.SimpleUploadedFile instead.", - category = DeprecationWarning, - stacklevel = 2 - ) - data = UploadedFile(data['filename'], data['content']) - + # UploadedFile objects should have name and size attributes. try: file_name = data.name file_size = data.size @@ -507,10 +498,10 @@ class ImageField(FileField): # but it must be called immediately after the constructor trial_image = Image.open(file) trial_image.verify() - except ImportError: + except ImportError: # Under PyPy, it is possible to import PIL. However, the underlying - # _imaging C module isn't available, so an ImportError will be - # raised. Catch and re-raise. + # _imaging C module isn't available, so an ImportError will be + # raised. Catch and re-raise. raise except Exception: # Python Imaging Library doesn't recognize it as an image raise ValidationError(self.error_messages['invalid_image']) @@ -643,7 +634,7 @@ class ChoiceField(Field): if value == smart_unicode(k): return True return False - + class MultipleChoiceField(ChoiceField): hidden_widget = MultipleHiddenInput widget = SelectMultiple -- cgit v1.3