Commit Graph

1576 Commits

Author SHA1 Message Date
Tim Graham 77d25dbd0f Refs #27753 -- Favored SafeString over SafeText. 2019-02-06 14:12:06 -05:00
Tim Graham d55e882927 Refs #27753 -- Deprecated django.utils.encoding.force_text() and smart_text(). 2019-02-06 14:12:06 -05:00
Aymeric Augustin 3bb6a4390c Refs #27753 -- Favored force/smart_str() over force/smart_text(). 2019-02-06 14:12:06 -05:00
Nick Pope 24b82cd201 Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
2019-02-06 13:48:39 -05:00
Tim Graham f09b0f6483 Refs #27753 -- Removed django.utils.safestring.SafeBytes. 2019-02-05 13:00:15 -05:00
Tim Graham 3004d7057f Refs #27753 -- Removed django.utils.functional.curry(). 2019-02-05 13:00:15 -05:00
Tim Graham 9a750cbd5c Refs #27753 -- Removed django.utils.decorators.ContextDecorator alias. 2019-02-05 13:00:11 -05:00
Tim Graham 41384812ef Refs #27753 -- Removed django.utils.six. 2019-02-05 12:58:55 -05:00
Tim Graham efe28d3f56 Refs #27753 -- Removed django.utils._os.abspathu(), upath(), and npath(). 2019-02-05 12:57:11 -05:00
Tim Graham d1f4b3c68a Refs #27753 -- Removed django.utils.decorators.available_attrs(). 2019-02-05 12:52:07 -05:00
Tim Graham c679f357a8 Refs #27753 -- Removed django.utils.lru_cache. 2019-02-05 12:52:07 -05:00
Tim Graham 83c2bc52c2
Refs #27753 -- Deprecated django.utils.http urllib aliases. 2019-02-04 18:53:11 -05:00
Jon Dufresne 290d8471bb Fixed #30147 -- Simplified directory creation with os.makedirs(..., exist_ok=True). 2019-01-31 12:53:36 -05:00
Tim Graham 7e6b214ed3 Fixed #30116 -- Dropped support for Python 3.5. 2019-01-30 10:19:48 -05:00
Tom Forbes 1e92407f83 Fixed #25624 -- Fixed autoreload crash with jinja2.ModuleLoader. 2019-01-28 14:17:50 -05:00
Jon Dufresne 7785e03ba8 Fixed #30137 -- Replaced OSError aliases with the canonical OSError.
Used more specific errors (e.g. FileExistsError) as appropriate.
2019-01-28 11:15:06 -05:00
Tom Forbes d8a2f4ec09 Removed redundant period in Watchman unavailable message. 2019-01-19 18:25:01 -05:00
Tim Graham f5060a1385 Advanced deprecation warnings for Django 3.0. 2019-01-17 11:15:27 -05:00
Tim Graham 958a7b4ca6 Refs #28965 -- Removed utils.http.cookie_date() per deprecation timeline. 2019-01-17 10:52:19 -05:00
Santiago Basulto 4fc35a9c3e Fixed #20147 -- Added HttpRequest.headers. 2019-01-16 13:38:47 -05:00
Tom Forbes c8720e7696 Fixed #27685 -- Added watchman support to the autoreloader.
Removed support for pyinotify (refs #9722).
2019-01-13 20:33:47 -05:00
Tim Graham 0004daa536
Used 4 space hanging indent for dictionaries.
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Jon Dufresne 6fe9c45b72 Fixed #30024 -- Made urlencode() and Client raise TypeError when None is passed as data. 2018-12-27 11:19:55 -05:00
Patrick Arminio ae180fa4b7 Fixed #29986 -- Added .format() support to ngettext_lazy strings. 2018-12-06 15:12:34 -05:00
Jaap Roes fc71bb11b1 Improved readability of translation's to_locale(). 2018-11-23 14:53:19 -05:00
Thomas Grainger 0607699902 Fixed #29478 -- Added support for mangled names to cached_property.
Co-Authored-By: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2018-11-19 13:40:49 -05:00
Tim Graham 803840abf7
Refs #29926 -- Removed usage of gettext.translation()'s deprecated codeset parameter.
https://bugs.python.org/issue33710
2018-11-06 20:22:47 -05:00
aspalding dc5e75d419 Fixed #29838 -- Fixed crash when combining Q objects with __in lookups and lists.
Regression in fc6528b25a.
2018-10-17 11:34:49 -04:00
aspalding 217f82d713 Refs #29838 -- Fixed make_hashable() for values that have lists or dicts nested in tuples.
And for non-hashable values that are iterable, e.g. sets.
2018-10-17 11:17:50 -04:00
aspalding 834c4ec8e4 Moved make_hashable() to django.utils and added tests. 2018-10-17 11:17:23 -04:00
Taoufik f07091a30f Fixed typo in django/utils/datastructures.py. 2018-10-14 11:20:22 -04:00
Tim Graham 1e3cd51163
Simplified django.utils.html.urlize(). 2018-10-12 12:15:26 -04:00
Tim Graham 910548634a Refs #29826 -- Removed unused characters from urlize configuration.
The HTML characters are unused because urlize is meant to be applied to
plain text and these characters aren't properly detected (refs #29826).
Angle brackets and quotes are present in word_split_re and therefore
won't be used in WRAPPING_PUNCTUATION.
2018-10-12 08:13:52 +02:00
Jon Dufresne c82893cb8c Refs #27795 -- Removed force_bytes() usage from django/utils/http.py.
django.utils.http.urlsafe_base64_encode() now returns a string, not a
bytestring. Since URLs are represented as strings,
urlsafe_base64_encode() should return a string. All uses immediately
decoded the bytestring to a string anyway.

As the inverse operation, urlsafe_base64_decode() accepts a string.
2018-10-10 14:38:22 -04:00
Sergey Fedoseev 277017aea4 Simplified utils.text.StreamingBuffer. 2018-10-04 08:28:03 -04:00
Sergey Fedoseev 8ef8bc0f64 Refs #28909 -- Simplifed code using unpacking generalizations. 2018-09-28 09:57:12 -04:00
Jon Dufresne 82f286cf6f Refs #29784 -- Switched to https:// links where available. 2018-09-26 08:48:47 +02:00
Jon Dufresne bb81c22d90 Refs #27795 -- Removed force_bytes() usage in utils/_os.py. 2018-09-25 11:27:36 -04:00
Jon Dufresne 8c3e0eb1c1 Normalized spelling of "lowercase" and "lowercased". 2018-09-25 10:30:18 -04:00
Javier Buzzi a0d63b02c3 Fixed #29772 -- Made LazyObject proxy __lt__() and __gt__(). 2018-09-19 13:51:01 -04:00
Jon Dufresne ee184e13cb Refs #27795 -- Removed force_bytes() usage in django/utils/cache.py. 2018-08-28 08:03:23 -04:00
Claude Paroz 201017df30 Fixed #29654 -- Made text truncation an ellipsis character instead of three dots.
Thanks Sudhanshu Mishra for the initial patch and Tim Graham for the review.
2018-08-21 17:46:45 +02:00
Mariusz Felisiak 9fee229874
Fixed #29643 -- Fixed crash when combining Q objects with __in lookups and lists.
Regression in fc6528b25a.
2018-08-08 08:51:20 +02:00
Josh Schneier f1bf069ec1 Refs #29244 -- Fixed django.utils.inspect.method_has_no_args() for bound methods. 2018-08-07 17:37:35 -04:00
Josh Schneier 756b859576 Renamed django.utils.inspect.func_has_no_args() to method_has_no_args(). 2018-08-07 17:37:35 -04:00
Tim Graham 2092206bee
Refs #29600 -- Updated django.utils.datetime_safe now that Python 2 is unsupported. 2018-08-02 10:20:24 -04:00
Andreas Hug a656a68127 Fixed CVE-2018-14574 -- Fixed open redirect possibility in CommonMiddleware. 2018-08-01 09:28:42 -04:00
Tim Graham 2ac7cd52b4
Refs #29600 -- Removed datetime_safe usage in feedgenerator.
The only effect would be if items in Atom feeds had a published date
year of < 1000 (ensuring those years are padded with leading zeros).
2018-07-26 16:49:15 -04:00
Claude Paroz b004bd62e8 Fixed #29412 -- Stopped marking slugify() result as HTML safe. 2018-07-20 10:44:30 -04:00
Claude Paroz 0adfba968e Fixed #29578 -- Made numberformat.format() honor forced l10n usage.
Thanks Sassan Haradji for the report.
2018-07-19 16:44:40 -04:00
Mariusz Felisiak a73cf8110e Removed duplicate words in various comments. 2018-07-18 11:54:15 -04:00
Sergey Fedoseev 338f741c5e Fixed #29546 -- Deprecated django.utils.timezone.FixedOffset. 2018-07-09 16:33:36 -04:00
Sergey Fedoseev 7d6fe18dde Simplified force_bytes(). 2018-07-09 12:25:55 -04:00
Sergey Fedoseev 857f860d56 Removed unneded str() calls prior to mark_safe(); simplified mark_safe(). 2018-07-09 11:25:11 -04:00
Przemysław Suliga d22b90b4ea Fixed #29525 -- Allowed is_safe_url()'s allowed_hosts arg to be a string. 2018-06-29 10:17:52 -04:00
Tim Graham 2ec151e35d Fixed #29514 -- Reverted "Used datetime.timezone.utc instead of pytz.utc for better performance."
This reverts commit 27ca5ce19f due to a
regression.
2018-06-28 11:14:26 -04:00
Chris Jerdonek f434f5b84f Refs #29253 -- Fixed method_decorator() crash if decorator sets a new attribute.
Regression in fdc936c913.
2018-06-27 11:46:07 -04:00
Tim Graham b9dd8512f2 Advanced deprecation warnings for Django 2.2. 2018-05-17 11:05:45 -04:00
Tim Graham 1e0cbc72e5
Moved to_language() to django.utils.translation.
Follow up to 1b7d524cfa.
2018-05-12 15:03:38 -04:00
Tim Graham 1b7d524cfa Consolidated duplicate to_locale() implementations.
Follow up to ac59ec8f1a.
2018-05-12 12:58:21 -04:00
Hasan Ramezani ac59ec8f1a Aliased trans_null.to_locale() to trans_real.to_locale().
The implementations have unintentionally diverged.
2018-05-12 10:54:22 -04:00
Claude Paroz 9c4ea63e87
Replaced TOKEN_* constants by TokenType enums.
Thanks Tim Graham for the review.
2018-05-10 17:51:51 +02:00
Maximilian Merz 78912ccd0e Fixed #21408 — German Translation for “3 days ago”
The problem:
“3 days ago” should translate to “vor 3 Tagen” in German, while “3 days” translates to “3 Tage”. #21408 describes that django always translated to “Tage”, even when the dative “Tagen” was correct. The same applies to months (“Monate”/“Monaten”) and years (“Jahre”/“Jahren”).

The solution:
Let `timesince` caller provide the string dict to use for the time-related strings.
2018-05-10 15:53:33 +02:00
Samir Shah 10b44e4525 Fixed #26688 -- Fixed HTTP request logging inconsistencies.
* Added logging of 500 responses for instantiated responses.
* Added logging of all 4xx and 5xx responses.
2018-05-04 20:55:03 -04:00
Brett Cannon 64b74804c5 Fixed #29334 -- Updated pypi.python.org URLs to pypi.org. 2018-04-17 20:24:27 -04:00
Chris Jerdonek fdc936c913 Fixed #29253 -- Made method_decorator(list) copy attributes. 2018-04-16 13:38:37 -04:00
Sergey Fedoseev 27ca5ce19f Used datetime.timezone.utc instead of pytz.utc for better performance. 2018-03-20 15:24:16 -04:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Tim Graham 97b7dd59bb Fixed CVE-2018-7537 -- Fixed catastrophic backtracking in django.utils.text.Truncator.
Thanks James Davis for suggesting the fix.
2018-03-06 08:30:40 -05:00
Tim Graham 8618271caa Fixed CVE-2018-7536 -- Fixed catastrophic backtracking in urlize and urlizetrunc template filters.
Thanks Florian Apolloner for assisting with the patch.
2018-03-06 08:30:40 -05:00
Sergey Fedoseev 4ff29a53e6 Refs #17476 -- Removed obsolete simplification of timezone names in cache key generation. 2018-03-03 14:56:39 -05:00
Patryk Zawadzki a20aae414e Fixed #29144 -- Made untranslated strings for territorial language variants use translations from the generic language variant. 2018-03-03 12:08:24 -05:00
Mariusz Felisiak 074a2f7f58
Refs #28909 -- Simplifed code using unpacking generalizations. 2018-02-26 18:23:31 +01:00
Sebastian Sangervasi 7905815510 Fixed #27449 -- Added django.utils.translation.get_supported_language_variant(). 2018-02-23 14:49:00 -05:00
Sebastian Sangervasi 5c4c87e55c Changed "language-code" to the more commonly used "language code". 2018-02-21 09:31:05 -05:00
Chillar Anand e8e0cfa9e5 Fixed #28755 -- Made check_for_language() include apps' locale directories. 2018-02-20 21:34:40 -05:00
Jon Dufresne 968329b5c2 Refs #27795 -- Replaced force_text() calls with str() in django.utils.html. 2018-02-09 16:47:45 -08:00
Jonas Haag 8c709d79cb Fixed #17419 -- Added json_tag template filter. 2018-02-07 18:38:12 -05:00
Grant Jenks d38a3169a4 Fixed #28977 -- Changed local-memory cache to use LRU culling.
LRU culling turns every read into a kind of write to the cache: cache keys
are moved to the first position in the OrderedDict when they are retrieved.
The RWLock which permitted multiple readers while prioritizing a single
writer is obsolete since all accesses are now writes.
2018-01-24 12:26:19 -05:00
Jon Dufresne ff05de760c Fixed #29038 -- Removed closing slash from HTML void tags. 2018-01-21 02:09:10 -05:00
Дилян Палаузов a38ae914d8 Fixed #28996 -- Simplified some boolean constructs and removed trivial continue statements. 2018-01-12 12:44:50 -05:00
Jon Dufresne 1e81a4b897 Fixed #28638 -- Made allowed_hosts a required argument of is_safe_url(). 2018-01-11 07:03:50 -05:00
Srinivas Reddy Thatiparthy acd3baf2ae Improved readability of utils.datetime_safe._findall(). 2018-01-08 14:49:43 -05:00
Sergey Fedoseev 44c5b239e0 Simplified django.utils.feedgenerator.rfc2822_date(). 2018-01-05 10:37:21 -05:00
Sergey Fedoseev c794b56811 Simplified django.utils.feedgenerator.rfc3339_date(). 2018-01-05 10:36:33 -05:00
Дилян Палаузов d7b2aa24f7 Fixed #28982 -- Simplified code with and/or. 2018-01-03 20:12:23 -05:00
Tim Graham acc8dd4142
Fixed #28984 -- Made assorted code simplifications. 2018-01-03 13:24:02 -05:00
Tim Graham ab7f4c3306 Refs #28965 -- Deprecated unused django.utils.http.cookie_date(). 2018-01-02 11:23:04 -05:00
Sergey Fedoseev ae6fa914aa Fixed #28926 -- Fixed loss of precision of big DurationField values on SQLite and MySQL. 2017-12-28 17:35:41 -05:00
Дилян Палаузов 4c599ece57 Fixed #28930 -- Simplified code with any() and all(). 2017-12-26 17:11:15 -05:00
Claude Paroz 23b21db31b Fixed #28594 -- Removed Jython docs and specific code
Thanks Andrey Martyanov for the reporti, and Tim Graham for the review.
2017-12-23 10:26:32 +01:00
Nick Pope f3a98224e6 Refs #28909 -- Simplifed code using unpacking generalizations. 2017-12-21 21:05:23 -05:00
Nick Pope d13a9e44de Fixed #28909 -- Simplified code using tuple/list/set/dict unpacking. 2017-12-11 07:08:45 -05:00
Tim Graham 2b81faab25
Fixed #28906 -- Removed unnecessary bool() calls. 2017-12-07 17:13:07 -05:00
Nick Pope c68f66e014 Refs #23919 -- Replaced super() calls for old-style classes. 2017-12-07 09:10:32 -05:00
Дилян Палаузов d2afa5eb23 Fixed #28860 -- Removed unnecessary len() calls. 2017-12-04 10:35:23 -05:00
Jozef 3d94ee8500 Simplified django.utils.cache.get_max_age(). 2017-12-04 08:57:55 -05:00
Nicolas Delaby 746caf3ef8 Fixed #28837 -- Fixed test client crash if an exception with more than one arg is raised.
Also removed usage of the problematic pattern elsewhere.

Regression in 6e55e1d88a.
2017-11-28 18:55:23 -05:00
Chris Lamb 3af305e8b8 Fixed #28810 -- Replaced '%' style logging formatting with str.format() style. 2017-11-18 19:15:08 -05:00
Chris Lamb 648957b707 Fixed #28798 -- Removed unused django.utils.dates.WEEKDAYS_REV, MONTHS_3_REV. 2017-11-17 15:37:58 -05:00