summaryrefslogtreecommitdiff
path: root/django/utils
AgeCommit message (Collapse)Author
2022-02-10Refs #32568 -- Optimized escape() by using SafeString instead of mark_safe().David
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-29Fixed #33465 -- Added empty __slots__ to SafeString and SafeData.Keryn Knight
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-12Changed django.utils.log.log_response() to take exception instance.Adam Johnson
There's little point retrieving a fresh reference to the exception in the legacy tuple format, when it's all available via the exception instance we already have.
2022-01-11Refs #30141 -- Removed unused branch in parse_duration().Mariusz Felisiak
Unused since 99fc5dc13c12d874ffc1c8f47a6421494e720b31.
2022-01-07Refs #32355 -- Removed unnecessary list() calls before reversed() on dictviews.Mariusz Felisiak
Dict and dictviews are iterable in reversed insertion order using reversed() in Python 3.8+.
2022-01-07Fixed #28628 -- Changed \d to [0-9] in regexes where appropriate.Ad Timmering
2022-01-04Refs #33216 -- Made @deconstructible do not change path for subclasses.Allen Jonathan David
2021-12-30Refs #27753 -- Removed unused django.utils.text._replace_entity() and ↵Mariusz Felisiak
_entity_re. Unused since 157ab32f3446da7fa1f9d716509c290069a2a156.
2021-12-21Optimized MiddlewareMixin coroutine check.Adam Johnson
2021-12-20Fixed #33368 -- Fixed parse_duration() crash on invalid separators for ↵mendespedro
decimal fractions.
2021-12-17Changed signatures of setting_changed signal receivers.Adam Johnson
2021-12-16Fixed #30127 -- Deprecated name argument of cached_property().mgaligniana
2021-12-14Fixed unescape_string_literal() crash on empty strings.Florian Apolloner
2021-12-03Fixed #33078 -- Added support for language regions in i18n_patterns().Maxim Piskunov
2021-12-02Updated various links to HTTPS and new locations.Mariusz Felisiak
Co-Authored-By: Nick Pope <nick@nickpope.me.uk>
2021-11-22Fixed #33302 -- Made element_id optional argument for json_script template ↵Baptiste Mispelon
filter. Added versionchanged note in documentation
2021-11-03Refs #33245 -- Minor edits to django.utils.html.urlize() changes.tim-mccurrach
Follow up to ad81b606a2b5276397460a654fc7ad901a54b91e.
2021-11-01Fixed #33245 -- Made django.utils.html.urlize() thread-safe.Timothy McCurrach
Regression in e567670b1abe61af4acfaa6a6a7e92a7acfa8b00.
2021-10-20Fixed #33043 -- Made method_decorator() preserve wrapper assignments.Vinay Karanam
Regression in f434f5b84f7fcea9a76a551621ecce70786e2899.
2021-10-15Fixed #33195 -- Refactored urlize() based on a class.Claude Paroz
This allows easier customization/
2021-10-14Removed unused DOTS list.Claude Paroz
Unused since 4ff389dcdc15884eef059b2b8dea4b710e0a3b98.
2021-10-12Fixed #28401 -- Allowed hashlib.md5() calls to work with FIPS kernels.Ade Lee
md5 is not an approved algorithm in FIPS mode, and trying to instantiate a hashlib.md5() will fail when the system is running in FIPS mode. md5 is allowed when in a non-security context. There is a plan to add a keyword parameter (usedforsecurity) to hashlib.md5() to annotate whether or not the instance is being used in a security context. In the case where it is not, the instantiation of md5 will be allowed. See https://bugs.python.org/issue9216 for more details. Some downstream python versions already support this parameter. To support these versions, a new encapsulation of md5() has been added. This encapsulation will pass through the usedforsecurity parameter in the case where the parameter is supported, and strip it if it is not. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-10-04Refs #33107 -- Optimized cached_import() helper.Nick Pope
2021-09-30Optimized @async_unsafe.Adam Johnson
Switched the order of the checks to reduce the overhead. Async unsafe methods are *normally* called syncrhonously, so we can avoid the overhead of checking the environment variable in the regular path.
2021-09-29Fixed #33027 -- Made autoreloader pass -X options.Chenyang Yan
2021-09-27Refs #32355 -- Used @functools.lru_cache as a straight decorator.Mariusz Felisiak
2021-09-27Refs #32355 -- Modernized subprocess.run() calls.Adam Johnson
2021-09-22Optimized handling case-insensitive mappings.Illia Volochii
Elements yielded by _destruct_iterable_mapping_values are always unpacked. Since unpacking can be done with any iterable, there is no need to convert elements to tuples. Also, such elements can be used directly in for loops, creating a dictionary of them is excessive. Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2021-09-20Advanced deprecation warnings for Django 4.1.Mariusz Felisiak
2021-09-16Fixed #32365 -- Made zoneinfo the default timezone implementation.Carlton Gibson
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick Pope, and Paul Ganssle for reviews.
2021-09-16Fixed #33107 -- Fixed import_string() crash on not fully initialized modules.Mariusz Felisiak
Regression in ecf87ad513fd8af6e4a6093ed918723a7d88d5ca. Thanks Collin Anderson for the report.
2021-09-14Fixed #32873 -- Deprecated settings.USE_L10N.Claude Paroz
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-09-10Fixed #33099 -- Improved performance of import_string().yujin
This improves performance of import_string() by avoiding multiple imports for the same path. Thanks Andrew Godwin and Keryn Knight for the implementation idea.
2021-08-30Fixed #32992 -- Restored offset extraction for fixed offset timezones.Carlton Gibson
Regression in 10d126198434810529e0220b0c6896ed64ca0e88.
2021-08-06Refs #32956 -- Corrected spelling of daylight saving time.David Smith
AP Stylebook: Saving not savings, no hyphen, and lowercase.
2021-08-05Refs #32986 -- Moved TRANSLATOR_COMMENT_MARK to ↵Chris Jerdonek
django.utils.translation.template.
2021-07-30Refs #32956 -- Updated words ending in -wards.David Smith
AP styleguide: Virtually none of the words ending with -wards end with an s.
2021-07-29Fixed 32956 -- Lowercased spelling of "web" and "web framework" where ↵David Smith
appropriate.
2021-07-20Refs #32940 -- Removed unnecessary branch in Node.add().Keryn Knight
The "data in self.children" branch was causing data.__eq__ to be called for each entries in "self.children" which resulted in a huge slowdown during queryset construction. It's purpose was to prevent queries of the form Model.objects.filter(foo='bar').filter(foo='bar') from resulting in WHERE foo='bar' AND foo='bar' but it's not covered by the suite and has arguable performance benefits since it's not very common and SQL engines are usually very good at folding/optimizing these. See also #32632 for prior discussion around comparing data to the Node's children. Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2021-07-20Refs #32940 -- Removed Node.add()'s unused squash parameter.Keryn Knight
Unused since its introduction in d3f00bd5706b35961390d3814dd7e322ead3a9a3. Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2021-07-19Fixed #32941 -- Removed get_format_modules()'s unused reverse argument.Keryn Knight
Unused since 0d8b523422fda71baa10807d5aebefd34bad7962.
2021-07-19Removed unnecessary tuple construction in Node.__eq__().Nick Pope
2021-07-13Simplified django.utils.dateformat methods.Nick Pope
This removes unnecessary format('O') call, remove unnecessary method calls for simple cases in TimeFormat, and simplifies time zone handling in TimeFormat.
2021-07-07Fixed #32904 -- Made parse_time() more strict.abhiabhi94
Thanks Keryn Knight for the report.
2021-07-07Fixed #32866 -- Fixed trimming trailing punctuation from escaped string in ↵Shipeng Feng
urlize().
2021-07-06Fixed #32892 -- Optimized django.utils.dateparse functions by using ↵Keryn Knight
fromisoformat().
2021-06-30Refs #32880 -- Moved logging reference to new document.Daniele Procida
Completed a first step in moving reference and how-to material out of the topic document.
2021-06-24Fixed #32727 -- Allowed spaces before time zone offset in parse_datetime().Ben Wilber