summaryrefslogtreecommitdiff
path: root/django/utils/encoding.py
AgeCommit message (Collapse)Author
2015-11-03[1.9.x] Fixed #25668 -- Misc spelling errorsVille Skyttä
Backport of 3ee18400ae9b916da1a3bee9c9c630fd223a2d3c from master
2015-06-05Fixed #24927 -- Used python_2_unicode_compatible from sixMatthew Somerville
2015-05-27Fixed #24836 -- Made force_text() resolve lazy objects.Tim Graham
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-12-08Fixed #23968 -- Replaced list comprehension with generators and dict ↵Jon Dufresne
comprehension
2014-11-03Fixed #18456 -- Added path escaping to HttpRequest.get_full_path().Unai Zalakain
2014-10-16Fixed #19508 -- Implemented uri_to_iri as per RFC.Anubhav Joshi
Thanks Loic Bistuer for helping in shaping the patch and Claude Paroz for the review.
2014-06-07Optimize is_protected_type slightly (used by force_text, which is used ↵Alex Gaynor
basically everywhere)
2013-11-02Correct flake8 E302 violationsRay Ashman Jr
2013-11-02More attacking E302 violatorsAlex Gaynor
2013-10-13Fixed #21198 -- Prevented invalid use of @python_2_unicode_compatible.Aymeric Augustin
Thanks jpic for the report and chmodas for working on a patch. Reverts 2ea80b94. Refs #19362.
2013-09-22Removed a few trailing backslashes.Aymeric Augustin
We have always been at war with trailing backslashes.
2013-09-06Fixed #20812 -- Error out if __unicode__/__str__ doesn't return a text type.Florian Apolloner
2013-09-06Fixed #21052 -- Small performance optimization.Aymeric Augustin
2013-09-06Fixed #18719 -- Made force_bytes more consistent with force_text.Aymeric Augustin
2013-09-05Took advantage of django.utils.six.moves.urllib.*.Aymeric Augustin
2013-09-02Replaced "not PY3" by "PY2", new in six 1.4.0.Aymeric Augustin
2013-06-28Removed django.utils.encoding.StrAndUnicode class, deprecated in Django 1.5.Ramiro Morales
2013-03-22Fixed #20108 -- Fixed filepath_to_uri decoding errorClaude Paroz
This was a regression due to unicode_literals usage. Thanks Ivan Virabyan for the report and the initial patch.
2013-03-02Fixed getting default encoding in get_system_usernameClaude Paroz
Refs #19933.
2013-03-02Added support for serializing BinaryFieldClaude Paroz
2012-12-29Advanced pending deprecation warnings.Aymeric Augustin
Also added stacklevel argument, fixed #18127.
2012-12-16Fixed #18718 - Documented django.utils.encoding.filepath_to_uriTim Graham
2012-10-24Remove a case that is no longer reachable in encodings.py.Alex Gaynor
This case was originally designed to handle Exception's which didn't gracefully support coercing themselves to unicode. However, because it lives in the `else` case of `if hasattr(s, '__unicode__'):` we can be sure it's no longer reachable in djanog anymore, because since Python 2.5 exception has subclassed object, which means Exception objects always have an __unicode__ method.
2012-09-04Fixed #18902 -- Made force_bytes properly handle exception inputClaude Paroz
Thanks Aymeric Augustin for the report and the initial patch.
2012-08-29Replaced many smart_bytes by force_bytesClaude Paroz
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-18Introduced force_bytes and force_str.Aymeric Augustin
This is consistent with the smart_* series of functions and it's going to be used by the next commit.
2012-08-18[py3] Ported django.utils.safestring.Aymeric Augustin
Backwards compatibility aliases were created under Python 2.
2012-08-14[py3] Fixed staticfiles testsClaude Paroz
2012-08-12[py3] Deprecated StrAndUnicode.Aymeric Augustin
This mix-in is superseded by the @python_2_unicode_compatible decorator.
2012-08-12[py3] Added python_2_unicode_compatible decorator.Aymeric Augustin
2012-08-07[py3] Ported django.utils.encoding.Aymeric Augustin
* 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-07-24Remove double isinstance check in force_unicodeJeroen Dekkers
2012-07-22[py3] Updated urllib/urllib2/urlparse imports.Aymeric Augustin
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[py3] Replaced unicode/str by six.text_type/bytes.Aymeric Augustin
2012-07-22[py3] Replaced basestring by six.string_types.Aymeric Augustin
2012-07-22[py3] Removed longs.Aymeric Augustin
2012-06-07Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.Claude Paroz
Thanks Vinay Sajip for the support of his django3 branch and Jannis Leidel for the review.
2012-05-23Replaced types.NoneType occurrencesClaude Paroz
In Python 3, types.NoneType is no more available.
2012-05-19Marked bytestrings with b prefix. Refs #18269Claude Paroz
This is a preparation for unicode literals general usage in Django (Python 3 compatibility).
2012-04-29Fixed #18013 -- Use the new 'as' syntax for exceptions.Claude Paroz
Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6).
2011-10-11Change some string literals to be unicode, because:Alex Gaynor
* It's the most micro of optimizations (forget I even said it) * It makes significantly more sense semantically, given these are functions which return unicode. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16957 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-04Fixed #15181 -- Ensure that special characters are escaped when querying for ↵Russell Keith-Magee
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
2010-09-27Fixed #14290 -- Made format localization faster by caching the format ↵Jannis Leidel
modules. Thanks, Teemu Kurppa and Anssi Kääriäinen for the report and initial patches. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13898 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-04Fixed #12164 -- Removed the Python 2.3 compatibility imports and ↵Russell Keith-Magee
workarounds. Thanks to timo and claudep for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-28Fixed #12302: Modified force_unicode to avoid raising unicode errors whenKaren Tracey
handed exceptions with non-ASCII bytestring data and no working unicode method under Python 2.6 and higher. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12621 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-03Fixed #12445 -- Added ' (single quote), @ (at sign), and ~ (tilde) to safe ↵Gary Wilson Jr
characters in `iri_to_uri` function. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12066 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-08Fixed #10335: handle system locals unknown to Python in timezone name ↵Jacob Kaplan-Moss
handling. Thanks, mitsuhiko. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-13Fixed #9522 -- Modified handling of values in base serializer so that field ↵Russell Keith-Magee
subclasses can define their own value_to_string() method for serialization. Thanks to Alex Koshelev for the report and initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10554 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-11Fixed #5903 -- DecimalField.get_default() now correctly returns a Decimal ↵Brian Rosner
object when the model instance was not retrieved from the database. Thanks Justin Driscoll and pigletto. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9823 bcc190cf-cafb-0310-a4f2-bffc1f526a37