Commit Graph

90 Commits

Author SHA1 Message Date
Russell Keith-Magee 18e79f1425 Fixed #20486 -- Ensure that file_move_safe raises an error if the destination already exists.
Thanks to kux for the report, and Russ Webber for the patch.
2013-06-20 18:55:27 +08:00
Ramiro Morales 0fa8d43e74 Replaced `and...or...` constructs with PEP 308 conditional expressions. 2013-05-26 23:47:50 -03:00
Preston Holmes d228c1192e Fixed #19866 -- Added security logger and return 400 for SuspiciousOperation.
SuspiciousOperations have been differentiated into subclasses, and
are now logged to a 'django.security.*' logger. SuspiciousOperations
that reach django.core.handlers.base.BaseHandler will now return a 400
instead of a 500.

Thanks to tiwoc for the report, and Carl Meyer and Donald Stufft
for review.
2013-05-25 16:27:34 -07:00
Claude Paroz 838f28974e Fixed #20427 -- Moved a variable initialization in storage.py
This is fixing commit 4e70ad11d2. Thanks mattias at elements.nl
for the report and Baptiste Mispelon for identifying the faulty
commit.
2013-05-17 18:31:52 +02:00
Daniel Lindsley 33793f7c3e Fixed #19934 - Use of Pillow is now preferred over PIL.
This starts the deprecation period for PIL (support to end in 1.8).
2013-05-14 19:32:04 -07:00
Marcin Biernat 664855b74e #18899 FileSystemStorage.save should support any file-like objects 2013-02-23 16:40:50 +01:00
Claude Paroz 7c5b244826 Fixed #17061 -- Factored out importing object from a dotted path
Thanks Carl Meyer for the report.
2013-02-04 16:38:25 +01:00
Florian Apolloner 7cb0cd5aff Replaced six.reraise with a simple raise. 2013-01-01 13:20:36 +01:00
Florian Apolloner a4a4b139cd Replaced e.message with e.args[0] in 3aa4b8165d. 2013-01-01 13:14:55 +01:00
Anton Baklanov 3aa4b8165d Fixed #19457 -- ImageField size detection failed for some files.
This was caused by PIL raising a zlib truncated stream error since we fed
the parser with chunks instead of the whole image.
2013-01-01 11:54:56 +01:00
Claude Paroz 34dcf51e06 Fixed #19367 -- Fixed saving ContentFile in filesystem storage
This was not working properly when ContentFile was initialized with
an unicode string.
Thanks Alexey Boriskin for the report and the test.
2012-12-06 17:14:44 +01:00
Aymeric Augustin fc10418fba Fixed #18963 -- Used a subclass-friendly pattern
for Python 2 object model compatibility methods.
2012-11-03 22:07:35 +01:00
Florian Apolloner e8c6aff3bf Fixed #18947 -- Don't make uploaded files executeable by default.
Thanks to Lauri Tirkkonen for the patch.
2012-09-17 22:53:10 +02:00
Claude Paroz ae88e73fa6 Replaced some smart_xxx by force_xxx equivalent
smart_str/smart_text should only be used when a potential lazy
string should be preserved in the result of the function call.
2012-08-30 15:46:16 +02:00
Claude Paroz 4e70ad11d2 Made FileSystemStorage accept both text and byte streams
Thanks Alexey Boriskin for his help on the patch.
2012-08-29 16:37:37 +02:00
Claude Paroz 361d6738f8 Fixed #11739 -- Made ContentFile support Unicode input 2012-08-29 11:21:33 +02:00
Claude Paroz ebc773ada3 Replaced many smart_bytes by force_bytes
In all those occurrences, we didn't care about preserving the
lazy status of the strings, but we really wanted to obtain a
real bytestring.
2012-08-29 11:20:32 +02:00
Karen Tracey e99293250e [py3] Fixed slow path through file_move_safe
This path is taken on Windows.
2012-08-18 15:44:09 -04:00
Aymeric Augustin 1ad05172cb [py3] Fixed file_storage tests. 2012-08-18 10:24:23 +02:00
Claude Paroz dce34dc969 [py3] Made __repr__ return str with Python 3 2012-08-12 20:45:39 +02:00
Aymeric Augustin d4a0b27838 [py3] Refactored __unicode__ to __str__.
* Renamed the __unicode__ methods
* Applied the python_2_unicode_compatible decorator
* Removed the StrAndUnicode mix-in that is superseded by
  python_2_unicode_compatible
* Kept the __unicode__ methods in classes that specifically
  test it under Python 2
2012-08-12 14:44:40 +02:00
Aymeric Augustin e7e08fd48b [py3] Replaced some __str__ methods by __unicode__
These methods actually return unicode.
2012-08-12 14:44:40 +02:00
Aymeric Augustin 2bb2eecb63 [py3] Removed redundant __str__ methods.
These classes already have an identical __unicode__ method, which
will be used after an upcoming refactoring.
2012-08-12 14:44:40 +02:00
Claude Paroz 576ec12f8e [py3] Replaced __nonzero__ by __bool__
Of course, __nonzero__ alias has been kept for Python 2 compatibility.
2012-08-08 15:02:31 +02:00
Aymeric Augustin c5ef65bcf3 [py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
  Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
  and smart_bytes under Python 2 (which is backwards compatible).
  Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
  want a str.
2012-08-07 12:00:22 +02:00
Florian Apolloner dd16b17099 Fixed a security issue in image uploading. Disclosure and release forthcoming. 2012-07-30 21:54:29 +02:00
Aymeric Augustin 0d914d08a0 [py3] Updated urllib/urllib2/urlparse imports.
Lots of functions were moved. Use explicit imports in all cases
to keey it easy to identify where the functions come from.
2012-07-22 09:29:55 +02:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Claude Paroz 2626ea4a74 Fixed #14681 -- Do not set mode to None on file-like objects.
gzip.GzipFile does not support files with mode set to None.
2012-05-31 10:02:35 +02:00
Claude Paroz 38408f8007 Marked bytestrings with b prefix. Refs #18269
This is a preparation for unicode literals general usage in
Django (Python 3 compatibility).
2012-05-19 17:43:34 +02:00
Claude Paroz 169b1a404c Replaced foo.next() by next(foo).
This new syntax for next() has been introduced in Python 2.6 and is
compatible with Python 3.
2012-05-10 20:15:49 +02:00
Claude Paroz 57102ce781 Used io.BytesIO also for ContentFile.
io.StringIO would force the content to be Unicode, which would be
slightly backwards incompatible.
2012-05-05 22:33:08 +02:00
Claude Paroz d7dfab59ea Replaced cStringIO.StringIO by io.BytesIO.
Also replaced StringIO.StringIO by BytesIO in some other appropriate
places. StringIO is not available in Python 3.
2012-05-05 21:41:44 +02:00
Alex Gaynor 1583d40224 Fixed the syntax used for the Python repl examples in docs and docstrings. 2012-05-05 09:54:30 -05:00
Claude Paroz 865cd35c9b Made more extensive usage of context managers with open. 2012-05-05 14:06:36 +02:00
Claude Paroz 3904b74a3f Fixed #18013 -- Use the new 'as' syntax for exceptions.
Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29 20:57:15 +02:00
Claude Paroz 5c954136ea Fixed #15644 -- Improved Django File wrapper to support more file-like objects. Thanks nickname123 and Michael Palumbo for working on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17871 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-05 15:44:04 +00:00
Aymeric Augustin c458700382 Fixed #16590 -- Accepted a 'name' argument in the constructor of ContentFile, for consistency with File.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17298 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-30 14:51:05 +00:00
Jannis Leidel c4cc875643 Fixed #16703 -- Raise an exception if the storage location of the DefaultStorageFinder is empty.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16863 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-21 15:58:32 +00:00
Jannis Leidel f3ae496201 Fixed #16833 -- Removed undocumented `mixin` parameter from the `Storage.open()` method as this was an undocumented and obscure feature. Thanks to Marty and Russell for sanity-checking.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16824 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-13 15:10:49 +00:00
Jannis Leidel d34bb3c833 Fixed #16108 -- Fixed another race condition in the FileSystemStorage backend with regard to deleting a file. Refs #16082, too. Thanks, Aymeric Augustin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16287 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-28 13:06:08 +00:00
Jannis Leidel 723b620c7e Fixed #16082 -- Fixed race condition in the FileSystemStorage backend with regard to creating directories. Thanks, pjdelport.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16280 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-26 08:21:35 +00:00
Russell Keith-Magee 090ff64204 Fixed #15181 -- Ensure that special characters are escaped when querying for the URL of an uploaded file. Thanks to e.generalov for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15409 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-04 14:43:10 +00:00
Alex Gaynor f5f18a38ab Fixed #14749 -- added support for using Django's file object as context managers. Thanks to Florian Apolloner for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14671 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-21 17:51:41 +00:00
Alex Gaynor 34b5739216 Remove the executable flag from uploadhandler.py, it wasn't. Thanks to Florian for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14528 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-11 17:51:14 +00:00
Alex Gaynor 3d69b21790 Fixed #14577 -- fixed a docstring typo. Thanks to dauerbaustelle for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-27 20:08:20 +00:00
Russell Keith-Magee a904e55859 Fixed #11509 -- Modified usage of "Web" to match our style guide in various documentation, comments and code. Thanks to timo and Simon Meers for the work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14069 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-09 08:12:50 +00:00
Jannis Leidel 58b704d8da Fixed #10497 -- Added a few time-related methods to the storage API. Thanks for the report and patch to Stephan Jaekel.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14012 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-08 15:11:59 +00:00
Luke Plant 76249c3964 Fixed #11158 - get_image_dimensions very slow/incorrect after 1 call
Thanks to kua for the report, and to kua, SmileyChris and SAn for the patch



git-svn-id: http://code.djangoproject.com/svn/django/trunk@13715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-10 18:45:25 +00:00
Karen Tracey 600aa6679e Fixed #11030: Reverted a change that assumed the file system encoding was utf8, and changed a test to demonstrate how that assumption corrupted uploaded non-ASCII file names on systems that don't use utf8 as their file system encoding (Windows for one, specifically). Thanks for the report to vrehak.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-02 21:58:49 +00:00