Mariusz Felisiak
ef46f3778a
Refs #32712 -- Removed django.utils.baseconv module per deprecation timeline.
2023-01-17 11:49:15 +01:00
sage
8cf3831822
Fixed #34243 -- Fixed timesince() crash with timezone-aware dates and interval longer than 1 month.
...
Regression in 8d67e16493
.
2023-01-05 16:38:19 +01:00
Nick Pope
65477fd7da
Added support for datetime.date to DateFormat.r().
2023-01-05 12:51:55 +01:00
GianpaoloBranca
8d67e16493
Fixed #33879 -- Improved timesince handling of long intervals.
2023-01-04 11:14:06 +01:00
Alex Vandiver
cbce427c17
Fixed #34194 -- Added django.utils.http.content_disposition_header().
2022-12-05 13:08:00 +01:00
Nick Pope
9bd174b9a7
Updated documentation and comments for RFC updates.
...
- Updated references to RFC 1123 to RFC 5322
- Only partial as RFC 5322 sort of sub-references RFC 1123.
- Updated references to RFC 2388 to RFC 7578
- Except RFC 2388 Section 5.3 which has no equivalent.
- Updated references to RFC 2396 to RFC 3986
- Updated references to RFC 2616 to RFC 9110
- Updated references to RFC 3066 to RFC 5646
- Updated references to RFC 7230 to RFC 9112
- Updated references to RFC 7231 to RFC 9110
- Updated references to RFC 7232 to RFC 9110
- Updated references to RFC 7234 to RFC 9111
- Tidied up style of text when referring to RFC documents
2022-11-10 13:52:17 +01:00
Jimmy Angelakos
07ebef566f
Refs #34000 -- Optimized handling None values in numberformat.format().
2022-09-12 13:02:50 +02:00
Jimmy Angelakos
e911e0996f
Fixed #34000 -- Fixed numberformat.format() crash on empty strings.
2022-09-12 12:54:12 +02:00
Carlton Gibson
e34dfad0a3
Refs #30213 -- Removed post-startup check for Watchman availability.
...
This is checked at startup in get_reloader(). The runtime check ties
the implementation to Watchman excessively.
2022-08-11 11:02:03 +02:00
Nick Pope
ddf0002bb7
Refs #32948 -- Renamed Node._new_instance() to Node.create().
...
Node._new_instance() was added in
6dd2b5468f
to work around Q.__init__()
having an incompatible signature with Node.__init__().
It was intended as a hook that could be overridden if subclasses needed
to change the behaviour of instantiation of their specialised form of
Node. In practice this doesn't ever seem to have been used for this
purpose and there are very few calls to Node._new_instance() with other
code, e.g. Node.__deepcopy__() calling Node and overriding __class__ as
required.
Rename this to Node.create() to make it a more "official" piece of
private API that we can use to simplify a lot of other areas internally.
The docstring and nearby comment have been reworded to read more
clearly.
2022-07-27 10:06:24 +02:00
Nick Pope
cc52e02c96
Refs #32948 -- Added more tests for django.utils.tree.Node.
...
The tests for creating new instances or copying instances of Node and
its subclasses didn't fully capture the behaviour of the implementation,
particularly around whether the `children` list or is contents were the
same as the source.
2022-07-27 07:58:29 +02:00
Nick Pope
769d7cce4a
Used AND, OR, XOR constants instead of hard-coded values.
2022-07-27 07:55:09 +02:00
Michael Manfre
03eec9ff6c
Updated vendored _urlsplit() to strip newline and tabs.
...
Refs Python CVE-2022-0391. Django is not affected, but others who
incorrectly use internal function url_has_allowed_host_and_scheme()
with unsanitized input could be at risk.
2022-07-01 08:48:38 +02:00
Hrushikesh Vaidya
72e41a0df6
Fixed #33779 -- Allowed customizing encoder class in django.utils.html.json_script().
2022-06-28 10:54:38 +02:00
Mehrdad
d4d5427571
Refs #33697 -- Used django.utils.http.parse_header_parameters() for parsing boundary streams.
...
This also removes unused parse_header() and _parse_header_params()
helpers in django.http.multipartparser.
2022-06-28 09:42:47 +02:00
Carlton Gibson
34e2148fc7
Refs #33173 -- Removed use of deprecated cgi module.
...
https://peps.python.org/pep-0594/#cgi
2022-05-11 14:06:31 +02:00
Mariusz Felisiak
439cd73c16
Refs #33173 -- Fixed test_dateparse tests on Python 3.11+.
...
date/datetime/time.fromisoformat() support any valid ISO 8601 format
in Python 3.11+, see https://github.com/python/cpython/issues/80010 .
2022-05-09 10:38:11 +02:00
Carlton Gibson
bb61f0186d
Refs #32365 -- Removed internal uses of utils.timezone.utc alias.
...
Remaining test case ensures that uses of the alias are mapped
canonically by the migration writer.
2022-03-24 06:29:50 +01:00
Florian Apolloner
4f92cf87b0
Prevented initialization of unused database connections.
2022-03-17 07:40:57 +01:00
Adam Johnson
a45f28f0ec
Rewrote strip_tags test file to lorem ipsum.
2022-03-08 14:50:06 +01:00
Mariusz Felisiak
d4fd31684a
Refs #33173 -- Used locale.getlocale() instead of getdefaultlocale().
...
locale.getdefaultlocale() was deprecated in Python 3.11, see
https://bugs.python.org/issue46659 .
2022-03-08 13:17:05 +01:00
Theo Alexiou
659d2421c7
Fixed #20296 -- Prevented mark_safe() from evaluating lazy objects.
2022-02-21 10:11:26 +01:00
Matthias Kestenholz
b2ed0d78f2
Refs #28358 -- Fixed infinite recursion in LazyObject.__getattribute__().
...
Regression in 97d7990abd
.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Theo Alexiou <theofilosalexiou@gmail.com>
2022-02-17 14:52:17 +01:00
Theo Alexiou
97d7990abd
Fixed #28358 -- Prevented LazyObject from mimicking nonexistent attributes.
...
Thanks Sergey Fedoseev for the initial patch.
2022-02-16 10:51:15 +01:00
Theo Alexiou
f9ec777a82
Fixed #26287 -- Added support for addition operations to SimpleLazyObject.
2022-02-10 11:24:51 +01:00
Mariusz Felisiak
7119f40c98
Refs #33476 -- Refactored code to strictly match 88 characters line length.
2022-02-07 20:37:05 +01:00
django-bot
9c19aff7c7
Refs #33476 -- Reformatted code with Black.
2022-02-07 20:37:05 +01:00
Keryn Knight
55022f75c1
Fixed #33465 -- Added empty __slots__ to SafeString and SafeData.
...
Despite inheriting from the str type, every SafeString instance gains
an empty __dict__ due to the normal, expected behaviour of type
subclassing in Python.
Adding __slots__ to SafeData is necessary, because otherwise inheriting
from that (as SafeString does) will give it a __dict__ and negate the
benefit added by modifying SafeString.
2022-01-29 13:50:34 +01:00
Ad Timmering
bdf3e156b4
Fixed #28628 -- Changed \d to [0-9] in regexes where appropriate.
2022-01-07 12:25:06 +01:00
Allen Jonathan David
205f67cd5b
Refs #33216 -- Made @deconstructible do not change path for subclasses.
2022-01-04 13:15:29 +01:00
Allen Jonathan David
194ca77092
Refs #21275 -- Added more tests for @deconstructible decorator.
2022-01-04 13:08:36 +01:00
mendespedro
4fd3044ca0
Fixed #33368 -- Fixed parse_duration() crash on invalid separators for decimal fractions.
2021-12-20 06:46:34 +01:00
mgaligniana
068b2c072b
Fixed #30127 -- Deprecated name argument of cached_property().
2021-12-16 18:52:27 +01:00
Florian Apolloner
e1d673c373
Fixed unescape_string_literal() crash on empty strings.
2021-12-14 20:19:44 +01:00
Florian Apolloner
5d9c512e5b
Added test for ValueErrors in unescape_string_literal().
2021-12-14 20:18:43 +01:00
Mariusz Felisiak
5def7f3f74
Updated various links to HTTPS and new locations.
...
Co-Authored-By: Nick Pope <nick@nickpope.me.uk>
2021-12-02 11:27:29 +01:00
Baptiste Mispelon
e6e664a711
Fixed #33302 -- Made element_id optional argument for json_script template filter.
...
Added versionchanged note in documentation
2021-11-22 11:52:19 +01:00
Chenyang Yan
36d54b7a14
Fixed #33027 -- Made autoreloader pass -X options.
2021-09-29 11:37:50 +02:00
Mariusz Felisiak
f1bcaa9be8
Refs #32074 -- Fixed find_module()/find_loader() warnings on Python 3.10+.
2021-09-16 20:20:54 +02:00
Carlton Gibson
306607d5b9
Fixed #32365 -- Made zoneinfo the default timezone implementation.
...
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick
Pope, and Paul Ganssle for reviews.
2021-09-16 12:11:05 +02:00
Claude Paroz
676bd084f2
Fixed #32873 -- Deprecated settings.USE_L10N.
...
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-09-14 12:05:43 +02:00
Carlton Gibson
cbba49971b
Fixed #32992 -- Restored offset extraction for fixed offset timezones.
...
Regression in 10d1261984
.
2021-08-30 10:12:46 +02:00
Jonny Park
4e8121e8e4
Fixed #32994 -- Fixed autoreloader tests when using 'python -m'.
2021-08-19 09:20:31 +02:00
David Smith
fbb1984046
Refs #32956 -- Updated words ending in -wards.
...
AP styleguide: Virtually none of the words ending with -wards end with
an s.
2021-07-30 20:34:50 +02:00
David Smith
1024b5e74a
Fixed 32956 -- Lowercased spelling of "web" and "web framework" where appropriate.
2021-07-29 06:24:12 +02:00
Nick Pope
6b513f0137
Fixed #32913 -- Made watchman reloader tests less flaky.
2021-07-23 11:40:57 +02:00
Nick Pope
6afc2a944c
Completed test coverage for django.utils.dateformat.
2021-07-13 13:21:10 +02:00
Nick Pope
ab0d751ddf
Used subTest() in utils_tests.test_dateformat.
2021-07-13 13:06:48 +02:00
abhiabhi94
cf6774a53b
Fixed #32904 -- Made parse_time() more strict.
...
Thanks Keryn Knight for the report.
2021-07-07 12:08:43 +02:00
Shipeng Feng
68cc04887b
Fixed #32866 -- Fixed trimming trailing punctuation from escaped string in urlize().
2021-07-07 11:19:33 +02:00
Keryn Knight
857320e9e0
Added more tests for parse_time().
2021-07-06 08:45:23 +02:00
Ben Wilber
fff4870bfa
Fixed #32727 -- Allowed spaces before time zone offset in parse_datetime().
2021-06-24 10:07:55 +02:00
Chris Jerdonek
7272e1963f
Fixed #32821 -- Updated os.scandir() uses to use a context manager.
2021-06-07 06:52:42 +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
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
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
Florian Apolloner
0b79eb3691
Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads.
2021-05-04 08:44:42 +02:00
Claude Paroz
e4430f22c8
Fixed #31937 -- Eased translation of time strings in some languages.
2021-04-10 20:23:12 +02: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
Adam Johnson
ac72a216a7
Refs #31372 -- Added django.utils.inspect tests for bound methods.
2021-03-22 13:17:46 +01:00
Hasan Ramezani
775b796d8d
Refs #32508 -- Raised ValueError instead of using "assert" in lazy().
2021-03-15 13:10:30 +01:00
Hasan Ramezani
2cd0ccef04
Added tests for AssertionErrors in get_complete_version() and _lazy_re_compile().
2021-03-15 13:03:30 +01:00
Nick Pope
afb0eb8bb3
Refs #24121 -- Added __repr__() to OrderedSet.
2021-03-10 09:29:05 +01:00
Markus Holtermann
d9a266d657
Updated Git branch "master" to "main".
...
This change follows a long discussion on django-develops:
https://groups.google.com/g/django-developers/c/tctDuKUGosc/
2021-03-09 08:48:32 +01:00
Diego Lima
2e5aa444d1
Fixed #32517 -- Made OrderedSet reversible.
...
Refs #32516 .
2021-03-08 08:22:07 +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
ae48601e6d
Skipped test_archive tests when bz2/lzma module is not installed.
2021-02-04 14:08:43 +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
Mariusz Felisiak
cfddca543a
Fixed isolation of utils_tests.test_autoreload tests.
2021-01-20 09:53:34 +01:00
Paul Ganssle
10d1261984
Refs #32365 -- Allowed use of non-pytz timezone implementations.
2021-01-19 11:59:37 +01:00
Mariusz Felisiak
e8b4f23115
Fixed isolation of test_check_errors_catches_all_exceptions.
2021-01-18 12:51:35 +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
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
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
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
starryrbs
57d05f94c3
Added more assertions for parse_duration() with negative timedeltas.
2020-12-21 10:15:22 +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
Florian Apolloner
98e05ccde4
Fixed #32233 -- Cleaned-up duplicate connection functionality.
2020-12-08 08:55:44 +01:00
Carlton Gibson
ead37dfb58
Fixed #32202 -- Fixed autoreloader argument generation for Windows with Python 3.7-.
2020-11-19 12:07:15 +01:00
Nick Pope
0cbccaebeb
Simplified TimeFormat.g().
2020-11-12 15:19:17 +01:00
Sam
895f6e4992
Fixed #32149 -- Added support for years < 1000 to DateFormat.y().
2020-11-12 12:43:06 +01:00
Tom Forbes
658bcc16f1
Fixed #25791 -- Implement autoreload behaviour for cached template loader.
2020-11-05 15:30:52 +01:00
Nick Pope
966b5b49b6
Updated MultiValueDict.update() to mirror dict.update() behavior.
...
Changes in behavior include:
- Accepting iteration over empty sequences, updating nothing.
- Accepting iterable of 2-tuples providing key-value pairs.
- Failing with the same or comparable exceptions for invalid input.
Notably this replaces the previous attempt to catch TypeError which was
unreachable as the call to .items() resulted in AttributeError on
non-dict objects.
2020-10-30 10:44:44 +01:00
Nick Pope
c3d9b8b28f
Increased test coverage for django.utils.datastructures.MultiValueDict.
...
Co-authored-by: Mads Jensen <mje@inducks.org>
2020-10-30 10:44:44 +01:00
Mads Jensen
825f8470f5
Increased test coverage for django.utils.datastructures.OrderedSet.
...
Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2020-10-30 10:44:44 +01:00
Simon Charette
4c675523bd
Refs #29838 , Refs #28507 -- Made make_hashable() ignore key order.
2020-10-05 20:42:46 +02:00
Nick Pope
fd209f62f1
Refs #21231 -- Backport urllib.parse.parse_qsl() from Python 3.8.
2020-09-03 14:24:42 +02:00
David Smith
b6dfdaff33
Completed test coverage for colorize().
2020-07-29 07:57:06 +02:00
Jon Dufresne
e1e4fd707f
Used context manager version of tempfile.TemporaryDirectory() in utils_tests.test_autoreload.
2020-07-20 11:08:23 +02:00
Tom Forbes
730711e828
Used temporary directory in RestartWithReloaderTests.test_manage_py().
...
Using the current directory can cause a PermissionError.
2020-07-20 09:16:16 +02:00
Tim Park
8fa9a6d29e
Fixed #31623 -- Allowed specifying number of adjacent time units in timesince()/timeuntil().
2020-07-16 09:44:28 +02:00