Changeset 3951f71 in trac.git
- Timestamp:
- Apr 13, 2022, 6:12:07 AM (2 years ago)
- Branches:
- 1.6-stable, trunk
- Children:
- e0f06af
- Parents:
- e5635a5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
messages.cfg
re5635a5 r3951f71 7 7 8 8 [html: **/templates/**.html] 9 extensions = jinja2.ext.do, jinja2.ext.with_10 9 variable_start_string = ${ 11 10 variable_end_string = } … … 18 17 19 18 [text: **/templates/**.txt] 20 extensions = jinja2.ext.do, jinja2.ext.with_21 19 variable_start_string = ${ 22 20 variable_end_string = } -
trac/dist.py
re5635a5 r3951f71 25 25 import io 26 26 import os 27 import pkg_resources 27 28 import re 28 29 from tokenize import generate_tokens, COMMENT, NAME, OP, STRING 29 30 31 import jinja2 30 32 from jinja2.ext import babel_extract as jinja2_extractor 31 33 … … 35 37 from distutils.errors import DistutilsOptionError 36 38 from setuptools.command.install_lib import install_lib as _install_lib 39 40 41 _jinja2_ext_with = pkg_resources.parse_version(jinja2.__version__) < \ 42 pkg_resources.parse_version('3') 37 43 38 44 … … 144 150 cleandoc_keywords.update(options['cleandoc_keywords']) 145 151 146 tokens = generate_tokens( fileobj.readline)152 tokens = generate_tokens(lambda: fileobj.readline().decode(encoding)) 147 153 tok = value = None 148 154 for _ in tokens: … … 167 173 elif call_stack == -1 and tok == COMMENT: 168 174 # Strip the comment token from the line 169 value = value .decode(encoding)[1:].strip()175 value = value[1:].strip() 170 176 if in_translator_comments and \ 171 177 translator_comments[-1][0] == lineno - 1: … … 275 281 extractor.feed(str(fileobj.read(), 'utf-8')) 276 282 extractor.close() 277 out.seek(0) 283 # extract_javascript expects a binary file object 284 out = io.BytesIO(out.getvalue().encode('utf-8')) 278 285 return extract_javascript(out, keywords, comment_tags, options) 279 286 … … 293 300 if fileobj: 294 301 extractor = jinja2_extractor 302 options.setdefault('extensions', 'jinja2.ext.do, jinja2.ext.with_' 303 if _jinja2_ext_with else 304 'jinja2.ext.do') 295 305 fileobj.seek(0) 296 306 for m in extractor(fileobj, keywords, comment_tags, options):
Note:
See TracChangeset
for help on using the changeset viewer.