Commit Graph

857 Commits

Author SHA1 Message Date
sanchjat 21aa2a5e78 Removed unnecessary line in DebugLexer.tokenize(). 2019-05-07 13:34:05 +02:00
Tobias Kunze e683613649 Fixed #20122 -- Made pluralize template filter return '' on invalid input. 2019-05-03 11:35:20 +02:00
Tobias Kunze e3968df527 Refs #20122 -- Corrected documentation of pluralize template filter. 2019-05-03 11:35:19 +02:00
Jon Dufresne 8b3f1c35dd Removed unnecessary assignments in various code. 2019-04-24 13:09:29 +02:00
Nathan Gaberel 624573726a Fixed #29791 -- Made Engine.render_to_string() honor autoescape. 2019-03-25 17:59:07 -04:00
Tim Graham 77d25dbd0f Refs #27753 -- Favored SafeString over SafeText. 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
Tom Forbes 7eb4db8732 Removed template_cache attribute from cached template loader.
Unused since 5d8da093a9.
2019-01-18 18:35:00 -05:00
Tim Graham fe6d5a2da2
Fixed #30107 -- Removed unused dirs variable from cache template loader keys.
Unused since 5d8da093a9.
2019-01-18 10:14:41 -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
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 ad9a28ee38 Refs #29784 -- Normalized Python docs links to omit the version. 2018-09-25 10:19:42 +02: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
luz.paz 97e637a87f Fixed typos in comments and docs. 2018-08-01 16:09:22 -04:00
Dražen Odobašić 9f3b9ffd51 Fixed #29617 -- Fixed Template crash if template_string is lazy.
Regression in 3a148f958d.
2018-07-31 09:57:11 -04:00
Sergey Fedoseev 529c3f264d Simplified BaseContext.__iter__(). 2018-07-11 09:12:50 -04:00
Sergey Fedoseev 857f860d56 Removed unneded str() calls prior to mark_safe(); simplified mark_safe(). 2018-07-09 11:25:11 -04:00
ryabtsev b4fd9b5ad4 Fixed #29432 -- Allowed passing an integer to the slice template filter. 2018-05-26 20:56:51 -04:00
Ryan Rubin a8d12bc280 Fixed #29400 -- Fixed crash in custom template filters that use decorated functions.
Regression in 620e9dd31a.
2018-05-25 11:11:46 -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
CHI Cheng 98019df855 Used double quotation marks for csrf form element. 2018-05-03 08:57:18 +02:00
Tom 11b8c30b9e Ref #23919 -- Replaced some os.path usage with pathlib.Path. 2018-04-19 21:30:00 -04:00
Jirka Vejrazka 6148dda72f Fixed #29288 -- Made {% widthratio %} assign to as var if an exception occurs. 2018-04-04 14:03:16 -04:00
Mads Jensen 623117d1f1 Removed unnecessary variable in Lexer.create_token(). 2018-03-24 19:10:56 -04:00
Mariusz Felisiak 074a2f7f58
Refs #28909 -- Simplifed code using unpacking generalizations. 2018-02-26 18:23:31 +01:00
Hasan Ramezani 5033999153 Fixed #29154 -- Corrected examples in pluralize docstring and added tests. 2018-02-23 14:20:00 -05:00
Jon Dufresne 1f3852b708 Refs #27795 -- Removed force_bytes() usage in django/template/loaders/cached.py. 2018-02-10 11:25:47 -05:00
Jonas Haag 8c709d79cb Fixed #17419 -- Added json_tag template filter. 2018-02-07 18:38:12 -05:00
Roger Gammans d0b44c44ef Fixed #29060 -- Made {% firstof %} assign '' to the asvar if all inputs are false. 2018-01-25 13:40:51 -05:00
Jon Dufresne ff05de760c Fixed #29038 -- Removed closing slash from HTML void tags. 2018-01-21 02:09:10 -05:00
Дилян Палаузов 4c599ece57 Fixed #28930 -- Simplified code with any() and all(). 2017-12-26 17:11:15 -05:00
Mariusz Felisiak 78247b80a8 Simplified and improved performance of floatformat filter.
Thanks Sergey Fedoseev for the review.
2017-12-19 05:08:10 -10:00
Tim Graham 2b81faab25
Fixed #28906 -- Removed unnecessary bool() calls. 2017-12-07 17:13:07 -05:00
Tim Graham 02d9419fe3
Fixed #28907 -- Removed unnecessary if statements. 2017-12-07 17:12:00 -05:00
Дилян Палаузов d2afa5eb23 Fixed #28860 -- Removed unnecessary len() calls. 2017-12-04 10:35:23 -05:00
Дилян Палаузов 23bf4ad87f Fixed #28795 -- Removed 'not in' checks and used dict.setdefault(). 2017-11-14 10:52:52 -05:00
Sergey Fedoseev f152678d36 Removed unneeded iter() call in IfNode.nodelist. 2017-11-11 19:36:21 -05:00
Claude Paroz 9ec7d8e514 Fixed #28730 -- Fixed loss of precision for large integer literals in templates
Thanks Fraser Nevett for the report and Tim Graham for patch edits.
2017-10-21 17:20:29 +02:00
Mads Jensen f7036b3e26 Fixed #28662 -- Silenced join template filter error if arg isn't iterable. 2017-10-20 09:46:31 -04:00
Jonas Haag d997ab7764 Fixed #28711 -- Fixed unordered_list template filter with lazy translations. 2017-10-18 19:45:10 -04:00
Tim Graham df0aebc893 Simplified IfNode.nodelist 2017-10-12 16:46:31 -04:00
Tim Graham cf59392e16 Removed unused ForNode.__iter__().
Unknown if it was ever used.
2017-10-12 16:46:31 -04:00
Mads Jensen ee7ab1b6e2 Refs #27546 -- Replaced hardcoded class name in ForNode.__repr__(). 2017-10-05 11:23:35 -04:00
Tim Graham 39eba25f47 Passed ignore_failures as a kwarg for readability in template tags.
Also removed unused VariableDoesNotExist catching where failures are ignored.
2017-10-04 09:26:13 -04:00
Mariusz Felisiak d896809a3a Refs #23919 -- Removed unneeded float()/int() calls. 2017-10-02 08:49:26 -04:00
Mads Jensen 77d1b19623 Removed always True if check in stringfilter decorator. 2017-09-30 18:01:35 -04:00
Mads Jensen 4508fafe16 Simplified various __eq__() methods. 2017-09-28 09:18:37 -04:00
Mariusz Felisiak 00709d704e Merged startswith() calls. 2017-09-25 09:18:29 -04:00
Tim Graham e62165b898 Refs #27175 -- Removed exception silencing from the {% include %} template tag.
Per deprecation timeline.
2017-09-22 12:51:18 -04:00
Sjoerd Job Postmus df41b5a05d Fixed #28593 -- Added a simplified URL routing syntax per DEP 0201.
Thanks Aymeric Augustin for shepherding the DEP and patch review.
Thanks Marten Kenbeek and Tim Graham for contributing to the code.
Thanks Tom Christie, Shai Berger, and Tim Graham for the docs.
2017-09-20 18:04:42 -04:00
Tim Graham 6e4c6281db Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365
because try/except performs better.
2017-09-07 08:16:21 -04:00
Sergey Fedoseev f2b93b509c Removed unneeded iter() calls.
A few of these were unnecessarily added in 2b281cc35e.
2017-08-23 16:48:29 -04:00
Claude Paroz ed77bea582 Refs #28502 -- Complemented stringformat tuple handling/test.
An additional test and a code change were suggested in a late review.
2017-08-22 08:45:08 -04:00
Srinivas Reddy Thatiparthy 4ead705cb3 Fixed #28502 -- Made stringformat template filter accept tuples 2017-08-21 09:04:43 +02:00
Srinivas Reddy Thatiparthy 0a24714b26 Removed unnecessary else clause in TemplateStrings.get_template(). 2017-08-07 10:24:58 -04:00
Mads Jensen 550cb3a365 Fixed #27818 -- Replaced try/except/pass with contextlib.suppress(). 2017-06-28 14:07:55 -04:00
John D'Ambrosio be68c0bf63 Fixed #28071 -- Fixed {% extends %} origin history. 2017-06-13 12:50:54 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Tom 94475aab80 Replaced some map() and filter() calls with generators. 2017-05-27 13:58:56 -04:00
Alexander Allakhverdiyev a7c6c705e8 Fixed #28129 -- Allowed custom template tags to use keyword-only arguments. 2017-05-11 10:09:44 -04:00
Alexander Allakhverdiyev 620e9dd31a Replaced django.utils.inspect.getargspec() with inspect.getfullargspec(). 2017-04-27 20:42:49 -04:00
Jon Dufresne 92bc727271 Replaced temporary lists used for passing arguments with iterables. 2017-04-26 10:54:20 -04:00
kapil garg dbfcedb499 Fixed #28001 -- Updated comment and tested context popping in ForNode.render(). 2017-04-06 19:04:29 -04:00
kapil garg 002fe07622 Fixed #27974 -- Kept resolved templates constant during one rendering cycle.
Thanks Florian Apolloner for the initial patch.
2017-04-03 22:29:39 -04:00
Carlton Gibson 6b3724fa11 Fixed #27359 -- Made Engine.get_default() return the first DjangoTemplates engine if multiple are defined. 2017-03-31 17:26:42 -04:00
Tim Graham e643ba8bcf Fixed #27956 -- Fixed display of errors in an {% extends %} child.
Thanks Ling-Xiao Yang for the report and test, and
Preston Timmons for the fix.
2017-03-25 08:22:12 -04:00
Vytis Banaitis 3dcc351691 Refs #23919 -- Used yield from. 2017-02-23 20:06:01 -05:00
Anton Samarchyan 4696078832 Refs #27656 -- Updated django.template/tag docstring verbs according to PEP 257. 2017-02-17 11:29:38 -05:00
Tim Graham fe2d288434 Fixed #27722 -- Reallowed using django.Template in {% include %}. 2017-02-11 06:51:57 -05:00
Claude Paroz 3a148f958d Refs #27795 -- Removed force_text from the template layer
Thanks Tim Graham for the review.
2017-02-07 17:14:02 +01:00
Claude Paroz c651331b34 Converted usage of ugettext* functions to their gettext* aliases
Thanks Tim Graham for the review.
2017-02-07 09:04:04 +01:00
Ryan O’Hara 7c4289d0b9 Fixed #27783 -- Switched VariableDoesNotExist.__str__() to repr() context.
Using __str__() and then repr'ing the result looks strange and can lead
to recursive rendering of forms.
2017-02-06 17:53:21 -05:00
Mads Jensen 86ae1d51ed Refs #27546 -- Removed hardcoded class names in __repr__() methods. 2017-02-04 11:42:45 -05:00
Vytis Banaitis 8838d4dd49 Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments. 2017-02-01 11:41:56 -05:00
Claude Paroz c688336ebc Refs #23919 -- Assumed request COOKIES and META are str 2017-01-30 14:13:29 +01:00
Claude Paroz fee42fd99e Refs #23919 -- Replaced usage of django.utils.http utilities with Python equivalents
Thanks Tim Graham for the review.
2017-01-26 19:49:03 +01:00
Vytis Banaitis d1bab24e01 Refs #23919, #27778 -- Removed obsolete mentions of unicode. 2017-01-26 08:19:27 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Tim Graham 632c4ffd9c Refs #23919 -- Replaced errno checking with PEP 3151 exceptions. 2017-01-25 10:13:08 -05:00
Mads Jensen ebf34c3cdc Removed unused variables that are overwritten. 2017-01-25 09:14:05 -05:00
Claude Paroz d2e7d15b4c Assumed iri_to_uri always returns a string
Thanks Tim Graham for the review.
2017-01-23 19:59:33 +01:00
Claude Paroz 6e55e1d88a Refs #23919 -- Replaced six.reraise by raise 2017-01-22 20:08:04 +01:00
Mariusz Felisiak c22212220a Refs #23919 -- Removed re.U and re.UNICODE (default on Python 3). 2017-01-21 14:28:16 -05:00
Tim Graham 990ce6386c Refs #5748 -- Removed obsolete Python/Windows workarounds in floatformat filter. 2017-01-21 13:53:35 -05:00
Tim Graham 4e729feaa6 Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Claude Paroz dc8834cad4 Refs #23919 -- Removed unneeded force_str calls 2017-01-20 08:44:31 +01:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Aymeric Augustin a556396339 Refs #23919 -- Replaced io.open() with open().
io.open() is an alias for open() on Python 3.
2017-01-18 21:45:12 -05:00
Aymeric Augustin eb422e476f Refs #23919 -- Removed obsolete __ne__() methods.
__ne__() defaults to the opposite of __eq__() on Python 3
when it doesn't return NotImplemented.
2017-01-18 21:44:00 -05:00
Aymeric Augustin 3cc5f01d9b Refs #23919 -- Stopped using django.utils.lru_cache(). 2017-01-18 21:42:40 -05:00
Claude Paroz 2b281cc35e Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Claude Paroz 7b2f2e74ad Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Claude Paroz f3c43ad1fd Refs #23919 -- Removed python_2_unicode_compatible decorator usage 2017-01-18 13:44:34 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham 60ca37d2e5 Refs #24046 -- Removed mark_for_escaping() per deprecation timeline. 2017-01-17 20:52:04 -05:00
Tim Graham 740f63a3df Refs #26263 -- Removed deprecated Context.has_key(). 2017-01-17 20:52:03 -05:00
Tim Graham ff419de263 Refs #25466 -- Removed aliases for LoaderOrigin and StringOrigin.
Per deprecation timeline.
2017-01-17 20:52:01 -05:00
Tim Graham 8377abd59e Refs #25120 -- Removed template.loaders.eggs.Loader per deprecation timeline. 2017-01-17 20:52:00 -05:00
Tim Graham 5d8da093a9 Refs #15053 -- Removed support for non-recursive template loading.
Per deprecation timeline.
2017-01-17 20:52:00 -05:00