| Age | Commit message (Collapse) | Author |
|
|
|
deferred annotations.
Provide a wrapper for safe introspection of user functions on Python 3.14+.
Follow-up to 601914722956cc41f1f2c53972d669ddee6ffc04.
|
|
Ideally, this will be reverted when an upstream solution is available for
https://github.com/python/cpython/issues/141560.
Thanks Patrick Rauscher for the report and Augusto Pontes for the
first iteration and test.
|
|
|
|
warning.
|
|
|
|
Added a warning for accessing PartialTemplate.source when debugging is disabled.
Thanks Sarah Boyce for the idea.
|
|
Language.
Introduced `{% partialdef %}` and `{% partial %}` template tags to
define and render reusable named fragments within a template file.
Partials can also be accessed using the `template_name#partial_name`
syntax via `get_template()`, `render()`, `{% include %}`, and other
template-loading tools.
Adjusted `get_template()` behavior to support partial resolution, with
appropriate error handling for invalid names and edge cases. Introduced
`PartialTemplate` to encapsulate partial rendering behavior.
Includes tests and internal refactors to support partial context
binding, exception reporting, and tag validation.
Co-authored-by: Carlton Gibson <carlton@noumenal.es>
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
|
|
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
|
|
variable names.
Regression in 5183f7c287a9a5d61ca1103b55166cda52d9c647.
Thank you to Jon Banafato and Baptiste Mispelon for the report.
|
|
|
|
* Refs #35816 -- Improved test coverage of FilterExpression.
* Fixed #35816 -- Made FilterExpression parse scientific numbers.
---------
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
|
|
|
|
in the template.
|
|
with __class_get_item__.
|
|
By setting a value in the `parser.extra_data` mapping, template tags
pass additional data out of the parsing context.
Any extra data set is exposed on the template via the matching
`.extra_data` attribute.
Library authors should use a key to namespace extra data. The 'django'
namespace is reserved for internal use.
|
|
Special characters lose their special meaning inside sets of characters.
"-" lose its special meaning if it's placed as the first or last
character.
Follow up to 7c6b66383da5f9a67142334cd2ed2d769739e8f1.
|
|
|
|
Co-authored-by: Anders Hovmöller <anders.hovmoller@dryft.se>
|
|
without required arguments.
Regression in 09341856ed9008875c1cc883dc0c287670131458.
|
|
|
|
|
|
In these cases Black produces unexpected results, e.g.
def make_random_password(
self,
length=10,
allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):
or
cursor.execute("""
SELECT ...
""",
[table name],
)
|
|
|
|
By determining the variable type within __init__() instead of resolve()
we can skip an isinstance() check at template runtime. Templates are
executed in production more often than the parse trees themselves,
assuming the cached Loader is used.
|
|
|
|
This adds an assertion in the code path where the method would otherwise
return None, which isn't allowed.
|
|
Lexer.tokenize().
|
|
|
|
not needed.
|
|
Thanks Chris Jerdonek for the review.
|
|
django.utils.translation.template.
|
|
Unnecessary since 47ddd6a4082d55d8856b7e6beac553485dd627f7.
|
|
This optimizes:
- Lexer.create_token() by avoiding startswith() calls,
- Parser.parse() by re-using the token type enum's value,
- Parser.extend_nodelist() by removing unnecessary isinstance() check,
- some Node subclasses by removing the implicit "nodelist" from
"child_nodelists",
- Variable.__init__() by avoiding startswith() calls.
|
|
Get the template that caused the exception and get the
exception info from that template, using the node that
caused the exception.
|
|
This avoids the following:
- checking that each item in the nodelist is a subclass of Node,
- calling str() on the render_annotated() output, because it's
documented that Node.render() must return a string,
- calling mark_safe() on the output, when the value to be wrapped is
definitively known to be a string because the result of ''.join()
is always of that type,
- using an intermediate list to store each individual string.
|
|
This avoids calling render() and handling exceptions, which is not
necessary for text nodes.
|
|
|
|
|
|
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
|
|
inspect.getcallargs() was deprecated in Python 3.5 and the Signature
API (PEP 362) has better support for decorated functions (by default,
it follows the __wrapped__ attribute set by functools.wraps for
example).
|
|
|
|
|
|
pop(0), which is used to fetch each token, is O(n) in the length of the
list. By reversing the list and operating off the end, we can perform
next_token(), prepend_token(), and delete_first_token() in constant
time.
|
|
Thanks to Mads Jenson for review.
|
|
EmptyResultSet moved in 46509cf13dbf049f75077981c29ef2c60b5a96ab.
FieldDoesNotExist moved in 8958170755b37ce346ae5257c1000bd936faa3b0.
BoundField and pretty_name moved in 8550161e531a603d57723850fb09c4c9b7ca60b9.
EMPTY_VALUES moved in 471596fc1afcb9c6258d317c619eaf5fd394e797.
BaseRunserverCommand moved in 5c53e30607014163872e89c221b206992a9acfef.
|
|
|
|
|
|
Regression in 3a148f958dddd97c1379081118c30fbede6b6bc4.
|
|
functions.
Regression in 620e9dd31a2146d70de740f96a8cb9a6db054fc7.
|