From: Armin Ronacher Date: Sun, 8 Jan 2017 22:40:38 +0000 (+0100) Subject: Fixed some string literal warnings. Fixes #646 X-Git-Tag: 2.9.4~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be16786d2d4bee025f978ecad95a48c5bf9620e4;p=thirdparty%2Fjinja.git Fixed some string literal warnings. Fixes #646 --- diff --git a/CHANGES b/CHANGES index 8e5b4ab3..4d8fabb1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ Jinja2 Changelog ================ +Version 2.9.4 +------------- +(unreleased bugfix release) + +- Solved some warnings for string literals. (#646) + Version 2.9.3 ------------- (bugfix release, released on January 8th 2017) diff --git a/jinja2/lexer.py b/jinja2/lexer.py index ca2914ac..b646cb91 100644 --- a/jinja2/lexer.py +++ b/jinja2/lexer.py @@ -288,7 +288,7 @@ class TokenStreamIterator(object): @implements_iterator class TokenStream(object): - """A token stream is an iterable that yields :class:`Token`\s. The + """A token stream is an iterable that yields :class:`Token`\\s. The parser however does not iterate over it but calls :meth:`next` to go one token ahead. The current active token is stored as :attr:`current`. """ @@ -500,7 +500,7 @@ class Lexer(object): ], # blocks TOKEN_BLOCK_BEGIN: [ - (c('(?:\-%s\s*|%s)%s' % ( + (c(r'(?:\-%s\s*|%s)%s' % ( e(environment.block_end_string), e(environment.block_end_string), block_suffix_re @@ -508,14 +508,14 @@ class Lexer(object): ] + tag_rules, # variables TOKEN_VARIABLE_BEGIN: [ - (c('\-%s\s*|%s' % ( + (c(r'\-%s\s*|%s' % ( e(environment.variable_end_string), e(environment.variable_end_string) )), TOKEN_VARIABLE_END, '#pop') ] + tag_rules, # raw block TOKEN_RAW_BEGIN: [ - (c('(.*?)((?:\s*%s\-|%s)\s*endraw\s*(?:\-%s\s*|%s%s))' % ( + (c(r'(.*?)((?:\s*%s\-|%s)\s*endraw\s*(?:\-%s\s*|%s%s))' % ( e(environment.block_start_string), block_prefix_re, e(environment.block_end_string), diff --git a/jinja2/nodes.py b/jinja2/nodes.py index 2c6a296a..aa4df723 100644 --- a/jinja2/nodes.py +++ b/jinja2/nodes.py @@ -721,7 +721,7 @@ class Concat(Expr): class Compare(Expr): """Compares an expression with some other expressions. `ops` must be a - list of :class:`Operand`\s. + list of :class:`Operand`\\s. """ fields = ('expr', 'ops') diff --git a/jinja2/runtime.py b/jinja2/runtime.py index 5c2089b8..03e303f1 100644 --- a/jinja2/runtime.py +++ b/jinja2/runtime.py @@ -100,7 +100,7 @@ class Context(object): The context is immutable. Modifications on :attr:`parent` **must not** happen and modifications on :attr:`vars` are allowed from generated template code only. Template filters and global functions marked as - :func:`contextfunction`\s get the active context passed as first argument + :func:`contextfunction`\\s get the active context passed as first argument and are allowed to access the context read-only. The template context supports read only dict operations (`get`,