Commit Graph

1695 Commits

Author SHA1 Message Date
Mateo Radman d6f3b58589 Fixed #32810 -- Optimized django.utils.formats.number_format() a bit.
Pre-calculate use_l10n for get_format() calls.
2021-06-05 13:48:26 +02:00
David Sanders 5685b7cd73
Fixed typos in comments and docs. 2021-05-29 12:51:14 +02:00
Mohammadreza Varasteh e93eb3d971 Fixed #32789 -- Made feeds emit elements with no content as self-closing tags. 2021-05-27 21:05:28 +02:00
Moriyoshi Koizumi 9e4780deda Fixed #32669 -- Fixed detection when started non-django modules which aren't packages with "python -m" in autoreloader. 2021-05-26 12:29:43 +02:00
Mariusz Felisiak 12b19a1d76
Fixed #32783 -- Fixed crash of autoreloader when __main__ module doesn't have __spec__ attribute.
Regression in ec6d2531c5.

Thanks JonathanNickelson for the report.
2021-05-26 11:19:47 +02:00
Simon Charette b81c7562fc Fixed #32717 -- Fixed filtering of querysets combined with the | operator.
Address a long standing bug in a Where.add optimization to discard
equal nodes that was surfaced by implementing equality for Lookup
instances in bbf141bcdc.

Thanks Shaheed Haque for the report.
2021-05-13 07:26:52 +02:00
Nick Pope 29e4ccb1a2 Fixed #32738 -- Deprecated django.utils.datetime_safe module. 2021-05-12 14:42:17 +02:00
Nick Pope 46346f8ea0 Refs #32738 -- Added sanitize_strftime_format() to replace datetime_safe. 2021-05-12 14:42:17 +02:00
Nick Pope 44accb066a Refs #32738, Refs #29600, Refs #29595 -- Removed unused django.utils.datetime_safe.time().
Unused since c72dde41e6.
2021-05-12 14:42:17 +02:00
Nick Pope d06c5b3581 Fixed #32366 -- Updated datetime module usage to recommended approach.
- Replaced datetime.utcnow() with datetime.now().
- Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp().
- Replaced datetime.utctimetuple() with datetime.timetuple().
- Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp().
2021-05-12 11:08:41 +02:00
Nick Pope 34363a391b Fixed #32735 -- Made DateFormat.Y() return a zero-padded year. 2021-05-12 08:17:06 +02:00
Hasan Ramezani 028f10fac6 Fixed #32712 -- Deprecated django.utils.baseconv module. 2021-05-07 11:57:40 +02:00
Maxim Beder 06fd4df41a Fixed #32479 -- Added fallbacks to subsequent language codes in translations.
Thanks Claude Paroz and Nick Pope for reviews.
2021-05-05 09:37:54 +02:00
Karthikeyan Singaravelan f9f6bd63c9 Refs #32074 -- Removed usage of deprecated Thread.setDaemon().
Thread.setDaemon() was deprecated in Python 3.10 and will be removed in
Python 3.12.
2021-05-04 12:07:18 +02:00
Mariusz Felisiak 623c8cd8f4
Refs #32074 -- Used asyncio.get_running_loop() instead of get_event_loop().
Using asyncio.get_event_loop() when there is no running event loop was
deprecated in Python 3.10, see https://bugs.python.org/issue39529.
2021-05-04 11:29:23 +02:00
Florian Apolloner 0b79eb3691 Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads. 2021-05-04 08:44:42 +02:00
pythonwood 071cf68630
Fixed #32709 -- Corrected examples in django/utils/baseconv.py docstring. 2021-05-04 07:09:09 +02:00
Nick Pope 2161db0792
Fixed capitalization of "ECMAScript" and "JavaScript". 2021-04-29 20:29:08 +02:00
Claude Paroz e4430f22c8 Fixed #31937 -- Eased translation of time strings in some languages. 2021-04-10 20:23:12 +02:00
Mariusz Felisiak b8c9e9fae1
Refs #32074 -- Removed usage of Python's deprecated distutils.version package.
The distutils package was formally deprecated in Python 3.10 and will
be removed in Python 3.12.
2021-04-09 12:56:27 +02:00
William Schwartz 9ee693bd6c Fixed #32316 -- Deferred accessing __file__.
Deferred accessing the module-global variable __file__ because the
Python import API does not guarantee it always exists—in particular, it
does not exist in certain "frozen" environments. The following changes
advanced this goal.

Thanks to Carlton Gibson, Tom Forbes, Mariusz Felisiak, and Shreyas
Ravi for review and feedback.
2021-04-01 14:33:30 +02:00
Mariusz Felisiak cfe47b7686
Fixed #32610 -- Fixed get_git_changeset() on Linux.
shell=True is required on Windows. Unfortunately passing a sequence to
subprocess.run() behaves differently on Linux, i.e. the first item
specifies the command string, and any additional items are treated as
additional arguments to the shell itself.

https://docs.python.org/3.9/library/subprocess.html#subprocess.Popen
https://docs.python.org/3.9/library/subprocess.html#converting-an-argument-sequence-to-a-string-on-windows

Regression in a44d80f88e.
2021-04-01 11:11:07 +02:00
William Schwartz cecdec91cf Refs #32355 -- Corrected comments about Python's _NamespacePath.
_NamespacePath supports indexing in Python 3.8+.
2021-03-26 10:17:10 +01:00
Nick Pope 6efc35b4fe
Optimized django.utils.text.capfirst().
Unconditionally coercing to str type twice is expensive.
2021-03-23 10:45:58 +01:00
Adam Johnson 562898034f Refs #31732 -- Fixed django.utils.inspect caching for bound methods.
Thanks Alexandr Artemyev for the report, and Simon Charette for the
original patch.
2021-03-22 13:17:54 +01:00
Claude Paroz d11b9ffcc0 Fixed #32581 -- Prevented to_locale() from corrupting locale names. 2021-03-22 07:08:58 +01:00
Hasan Ramezani 775b796d8d Refs #32508 -- Raised ValueError instead of using "assert" in lazy(). 2021-03-15 13:10:30 +01:00
Jonny Park dc86a25a67 Refs #24121 -- Added __repr__() to MiddlewareMixin and subclasses. 2021-03-10 21:16:58 +01:00
Nick Pope afb0eb8bb3
Refs #24121 -- Added __repr__() to OrderedSet. 2021-03-10 09:29:05 +01:00
Diego Lima 2e5aa444d1 Fixed #32517 -- Made OrderedSet reversible.
Refs #32516.
2021-03-08 08:22:07 +01:00
François Freitag 7ca7f4495b Refs #21429 -- Added SimpleTestCase.assertNoLogs() on Python < 3.10. 2021-03-02 20:35:33 +01:00
Carlton Gibson 4372233ebf Refs #32355 -- Restored PY36 and PY37 version constants.
Partially reverts ec0ff40631.

PY36 should be removed when Django 2.2 is EOL.
PY37 should be removed when Django 3.2 is EOL.

Thanks to Tim Graham for the report.
2021-02-10 19:57:11 +01:00
Mariusz Felisiak ec0ff40631 Fixed #32355 -- Dropped support for Python 3.6 and 3.7 2021-02-10 10:20:54 +01:00
Mariusz Felisiak 05413afa8c Fixed CVE-2021-3281 -- Fixed potential directory-traversal via archive.extract().
Thanks Florian Apolloner, Shai Berger, and Simon Charette for reviews.

Thanks Wang Baohua for the report.
2021-02-01 09:07:36 +01:00
Paul Ganssle 10d1261984 Refs #32365 -- Allowed use of non-pytz timezone implementations. 2021-01-19 11:59:37 +01:00
Mariusz Felisiak b4c5f878bd Advanced deprecation warnings for Django 4.0. 2021-01-14 17:50:04 +01:00
Mariusz Felisiak be6e468130 Refs #31359 -- Made get_random_string()'s length argument required.
Per deprecation timeline.
2021-01-14 17:50:04 +01:00
Mariusz Felisiak 4bb30fe5d5 Refs #26601 -- Made get_response argument required and don't accept None in middleware classes.
Per deprecation timeline.
2021-01-14 17:50:04 +01:00
Mariusz Felisiak 9e456f3166 Refs #30747 -- Removed django.utils.http.is_safe_url() per deprecation timeline. 2021-01-14 17:50:04 +01:00
Mariusz Felisiak 157ab32f34 Refs #27753 -- Removed django.utils.text.unescape_entities() per deprecation timeline. 2021-01-14 17:50:04 +01:00
Mariusz Felisiak d134b0b93e Refs #15902 -- Stopped set_language() storing user's language in the session.
Per deprecation timeline.
2021-01-14 17:50:04 +01:00
Mariusz Felisiak 52a238ddf2 Refs #30165 -- Removed ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and ungettext_lazy() per deprecation timeline. 2021-01-14 17:50:04 +01:00
Mariusz Felisiak 810f037b29 Refs #27753 -- Removed django.utils.encoding.force_text() and smart_text() per deprecation timeline. 2021-01-14 17:50:04 +01:00
Mariusz Felisiak 88ed1c8d08 Refs #27753 -- Removed django.utils.http urllib aliases per deprecation timeline. 2021-01-14 17:50:04 +01:00
Florian Apolloner 64cc9dcdad Refs #31358 -- Added constant for get_random_string()'s default alphabet. 2021-01-13 20:40:40 +01:00
William Schwartz ec6d2531c5 Fixed #32314 -- Fixed detection when started non-django modules with "python -m" in autoreloader.
django.utils.autoreload.get_child_arguments() detected when Python was
started with the `-m` option only for `django` module. This commit
changes the logic to check __spec__, see
https://docs.python.org/3/reference/import.html#main-spec

Now packages can implement their own __main__ with the runserver
command.
2021-01-05 21:03:29 +01:00
starryrbs 2a76f43134 Fixed #32269 -- Fixed parse_duration() for negative days in ISO 8601 format. 2020-12-21 10:28:07 +01:00
Hasan Ramezani 577f2338f1 Fixed #32208 -- Allowed adding lazy() objects.
Co-authored-by: Claude Paroz <claude@2xlibre.net>
2020-12-21 09:24:41 +01:00
Adam Johnson ef39a8829b Added docstring to django.utils.inspect.func_accepts_kwargs(). 2020-12-14 18:08:37 +01:00
Florian Apolloner 98e05ccde4 Fixed #32233 -- Cleaned-up duplicate connection functionality. 2020-12-08 08:55:44 +01:00