Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed deprecated UploadedFile.data attribute. Refs #7614.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7861 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f804e7f03810f5495445a2960d1ea7c6d0635328 1 parent c83e9ab
Jacob Kaplan-Moss authored July 07, 2008

Showing 1 changed file with 9 additions and 1 deletion. Show diff stats Hide diff stats

  1. 10  django/core/files/uploadedfile.py
10  django/core/files/uploadedfile.py
@@ -96,9 +96,17 @@ def chunks(self, chunk_size=None):
96 96
     filename = deprecated_property(old="filename", new="name")
97 97
     file_name = deprecated_property(old="file_name", new="name")
98 98
     file_size = deprecated_property(old="file_size", new="size")
99  
-    data = deprecated_property(old="data", new="read", readonly=True)
100 99
     chunk = deprecated_property(old="chunk", new="chunks", readonly=True)
101 100
 
  101
+    def _get_data(self):
  102
+        warnings.warn(
  103
+            message = "UploadedFile.data is deprecated; use UploadedFile.read() instead.",
  104
+            category = DeprecationWarning,
  105
+            stacklevel = 2
  106
+        )
  107
+        return self.read()
  108
+    data = property(_get_data)
  109
+
102 110
     def multiple_chunks(self, chunk_size=None):
103 111
         """
104 112
         Returns ``True`` if you can expect multiple chunks.

0 notes on commit f804e7f

Please sign in to comment.
Something went wrong with that request. Please try again.