summaryrefslogtreecommitdiff
path: root/django/utils/encoding.py
AgeCommit message (Collapse)Author
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
2008-08-26Fixed #6353 (again) by making force_unicode() and smart_str() a bit more robustMalcolm Tredinnick
in the face of funky Exception instances. This is slightly symptomatic of problems in the calling code, but we don't want to raise a secondary exception whilst trying to display the first one. Based on a patch from Karen Tracey. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8588 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-22Fixed #7847 -- Removed a whole bunch of unused imports from throughout the ↵Adrian Holovaty
codebase. Thanks, julien git-svn-id: http://code.djangoproject.com/svn/django/trunk@8046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-03Fixed #6301 -- Added '*' to the characters not converted by iri_to_uri(), asMalcolm Tredinnick
pointed out by samidh. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7064 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-14Implemented auto-escaping of variable output in templates. Fully ↵Malcolm Tredinnick
controllable by template authors and it's possible to write filters and templates that simulataneously work in both auto-escaped and non-auto-escaped environments if you need to. Fixed #2359 See documentation in templates.txt and templates_python.txt for how everything works. Backwards incompatible if you're inserting raw HTML output via template variables. Based on an original design from Simon Willison and with debugging help from Michael Radziej. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6671 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04Fixed #5640 -- Added some extra error reporting when smart_unicode() orMalcolm Tredinnick
force_unicode() raise a UnicodeDecodeError. This should at least help people identify which is the bad piece of data they passed in. About the best we can do here. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6649 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-20Added datetime.date to the things ignored by strings_only in [6406].Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6567 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-22Fixed #5553 -- Fixed a serialization problem with datetime and time objects. ↵Russell Keith-Magee
Thanks to pigletto for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6406 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15Fixed a small bug in strings_only handling for force_unicode().Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-06Fixed #5077 -- django/utils/encoding.py no longer imports settings, as it ↵Adrian Holovaty
doesn't use that module. Thanks, Collin Grady git-svn-id: http://code.djangoproject.com/svn/django/trunk@5810 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04Merged Unicode branch into trunk (r4952:5608). This should be fullyMalcolm Tredinnick
backwards compatible for all practical purposes. Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702 git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04Added a FIXME that I forgot to include earlier.Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4923 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-04Moved smart_unicode and StrAndUnicode to django.utils.encoding. They are usefulMalcolm Tredinnick
outside of newforms. This is backwards compatible as far as smart_unicode goes (since newforms.util still imports it). All imports of smart_unicode and StrAndUnicode have also been updated. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4918 bcc190cf-cafb-0310-a4f2-bffc1f526a37