remove Python 2 from docs
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 0c75d48 · Browse files · 15 files·+112 added−242 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
15 files+112 added−242 removed
- other:+112 added−242 removed
Provenance
- Commit
f28b25e- Tree
72273fa- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
0c75d48
15 files changed+112 added−242 removed
modified:docs/api.rst+27 added-93 removed
58 unmodified lines59 for security reasons. As such you are encouraged to explicitly60 configure autoescaping now instead of relying on the default.61 62 63-Unicode64--------65-66-Jinja is using Unicode internally which means that you have to pass Unicode67-objects to the render function or bytestrings that only consist of ASCII68-characters. Additionally newlines are normalized to one end of line69-sequence which is per default UNIX style (``\n``).70-71-Python 2.x supports two ways of representing string objects. One is the72-`str` type and the other is the `unicode` type, both of which extend a type73-called `basestring`. Unfortunately the default is `str` which should not74-be used to store text based information unless only ASCII characters are75-used. With Python 2.6 it is possible to make `unicode` the default on a per76-module level and with Python 3 it will be the default.77-78-To explicitly use a Unicode string you have to prefix the string literal79-with a `u`: ``u'Hänsel und Gretel sagen Hallo'``. That way Python will80-store the string as Unicode by decoding the string with the character81-encoding from the current Python module. If no encoding is specified this82-defaults to 'ASCII' which means that you can't use any non ASCII identifier.83-84-To set a better module encoding add the following comment to the first or85-second line of the Python module using the Unicode literal::86-87- # -*- coding: utf-8 -*-88-89-We recommend utf-8 as Encoding for Python modules and templates as it's90-possible to represent every Unicode character in utf-8 and because it's91-backwards compatible to ASCII. For Jinja the default encoding of templates92-is assumed to be utf-8.93-94-It is not possible to use Jinja to process non-Unicode data. The reason95-for this is that Jinja uses Unicode already on the language level. For96-example Jinja treats the non-breaking space as valid whitespace inside97-expressions which requires knowledge of the encoding or operating on an98-Unicode string.99-100-For more details about Unicode in Python have a look at the excellent101-`Unicode documentation`_.102-103-Another important thing is how Jinja is handling string literals in104-templates. A naive implementation would be using Unicode strings for105-all string literals but it turned out in the past that this is problematic106-as some libraries are typechecking against `str` explicitly. For example107-`datetime.strftime` does not accept Unicode arguments. To not break it108-completely Jinja is returning `str` for strings that fit into ASCII and109-for everything else `unicode`:110-111->>> m = Template(u"{% set a, b = 'foo', 'föö' %}").module112->>> m.a113-'foo'114->>> m.b115-u'f\xf6\xf6'116-117-118-.. _Unicode documentation: https://docs.python.org/3/howto/unicode.html119-63 High Level API64 --------------65 66 The high-level API is the API you will use in the application to load and176 unmodified lines243 Notes on Identifiers244 --------------------245 246 Jinja uses Python naming rules. Valid identifiers can be any combination304-of Unicode characters accepted by Python.247+of characters accepted by Python.248 249 Filters and tests are looked up in separate namespaces and have slightly250 modified identifier syntax. Filters and tests may contain dots to group251 filters and tests by topic. For example it's perfectly valid to add a309-function into the filter dict and call it `to.unicode`. The regular252+function into the filter dict and call it `to.str`. The regular253 expression for filter and test identifiers is254 ``[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)*```.255 256 13 unmodified lines270 .. autoclass:: jinja2.Undefined()271 272 .. attribute:: _undefined_hint273 331- Either `None` or an unicode string with the error message for332- the undefined object.274+ Either `None` or a string with the error message for the275+ undefined object.276 277 .. attribute:: _undefined_obj278 279 Either `None` or the owner object that caused the undefined object29 unmodified lines309 Undefined objects are created by calling :attr:`undefined`.310 311 .. admonition:: Implementation312 370- :class:`Undefined` objects are implemented by overriding the special371- `__underscore__` methods. For example the default :class:`Undefined`372- class implements `__unicode__` in a way that it returns an empty373- string, however `__int__` and others still fail with an exception. To374- allow conversion to int by returning ``0`` you can implement your own::313+ :class:`Undefined` is implemented by overriding the special314+ ``__underscore__`` methods. For example the default315+ :class:`Undefined` class implements ``__str__`` to returns an empty316+ string, while ``__int__`` and others fail with an exception. To317+ allow conversion to int by returning ``0`` you can implement your318+ own subclass.319 320+ .. code-block:: python321+322 class NullUndefined(Undefined):323 def __int__(self):324 return 0325+326 def __float__(self):327 return 0.0328 382- To disallow a method, just override it and raise383- :attr:`~Undefined._undefined_exception`. Because this is a very common384- idiom in undefined objects there is the helper method385- :meth:`~Undefined._fail_with_undefined_error` that does the error raising386- automatically. Here a class that works like the regular :class:`Undefined`387- but chokes on iteration::329+ To disallow a method, override it and raise330+ :attr:`~Undefined._undefined_exception`. Because this is very331+ common there is the helper method332+ :meth:`~Undefined._fail_with_undefined_error` that raises the error333+ with the correct information. Here's a class that works like the334+ regular :class:`Undefined` but fails on iteration::335 336 class NonIterableUndefined(Undefined):390- __iter__ = Undefined._fail_with_undefined_error337+ def __iter__(self):338+ self._fail_with_undefined_error()339 340 341 The Context342 -----------179 unmodified lines522 Example::523 524 env.policies['urlize.rel'] = 'nofollow noopener'525 578-``compiler.ascii_str``:579- This boolean controls on Python 2 if Jinja should store ASCII only580- literals as bytestring instead of unicode strings. This used to be581- always enabled for Jinja versions below 2.9 and now can be changed.582- Traditionally it was done this way since some APIs in Python 2 failed583- badly for unicode strings (for instance the datetime strftime API).584- Now however sometimes the inverse is true (for instance str.format).585- If this is set to False then all strings are stored as unicode586- internally.587-526 ``truncate.leeway``:527 Configures the leeway default for the `truncate` filter. Leeway as528 introduced in 2.9 but to restore compatibility with older templates529 it can be configured to `0` to get the old behavior back. The default83 unmodified lines613 .. autoexception:: jinja2.TemplateSyntaxError614 615 .. attribute:: message616 679- The error message as utf-8 bytestring.617+ The error message.618 619 .. attribute:: lineno620 683- The line number where the error occurred621+ The line number where the error occurred.622 623 .. attribute:: name624 687- The load name for the template as unicode string.625+ The load name for the template.626 627 .. attribute:: filename628 691- The filename that loaded the template as bytestring in the encoding692- of the file system (most likely utf-8 or mbcs on Windows systems).629+ The filename that loaded the template in the encoding of the630+ file system (most likely utf-8, or mbcs on Windows systems).631 694- The reason why the filename and error message are bytestrings and not695- unicode strings is that Python 2.x is not using unicode for exceptions696- and tracebacks as well as the compiler. This will change with Python 3.697-632 .. autoexception:: jinja2.TemplateRuntimeError633 634 .. autoexception:: jinja2.TemplateAssertionError635 191 unmodified lines827 This is the low level render function. It's passed a :class:`Context`828 that has to be created by :meth:`new_context` of the same template or829 a compatible template. This render function is generated by the830 compiler from the template code and returns a generator that yields897- unicode strings.831+ strings.832 833 If an exception in the template code happens the template engine will834 not rewrite the exception but pass through the original one. As a835 matter of fact this function should only be called from within a32 unmodified linesmodified:docs/extensions.rst+4 added-6 removed
42 unmodified lines43 44 .. method:: jinja2.Environment.install_gettext_translations(translations, newstyle=False)45 46 Installs a translation globally for the environment. The47- ``translations`` object must implement ``gettext`` and ``ngettext``48- (or ``ugettext`` and ``ungettext`` for Python 2).47+ ``translations`` object must implement ``gettext`` and ``ngettext``.48 :class:`gettext.NullTranslations`, :class:`gettext.GNUTranslations`,49 and `Babel`_\s ``Translations`` are supported.50 51 .. versionchanged:: 2.5 Added new-style gettext support.9 unmodified lines61 .. method:: jinja2.Environment.install_gettext_callables(gettext, ngettext, newstyle=False)62 63 Install the given ``gettext`` and ``ngettext`` callables into the64 environment. They should behave exactly like66- :func:`gettext.gettext` and :func:`gettext.ngettext` (or67- ``ugettext`` and ``ungettext`` for Python 2).65+ :func:`gettext.gettext` and :func:`gettext.ngettext`.66 67 If ``newstyle`` is activated, the callables are wrapped to work like68 newstyle callables. See :ref:`newstyle-gettext` for more information.69 13 unmodified lines83 - ``lineno`` is the number of the line on which the string was84 found.85 - ``function`` is the name of the ``gettext`` function used (if86 the string was extracted from embedded Python code).89- - ``message`` is the string itself (``unicode`` on Python 2), or a90- tuple of strings for functions with multiple arguments.87+ - ``message`` is the string itself, or a tuple of strings for88+ functions with multiple arguments.89 90 If `Babel`_ is installed, see :ref:`babel-integration` to extract91 the strings.92 310 unmodified linesmodified:docs/faq.rst+10 added-30 removed
123 unmodified lines124 instead that one can assign to a variable by using set::125 126 {% set comments = get_latest_comments() %}127 128-My tracebacks look weird. What's happening?129---------------------------------------------128+My tracebacks look weird. What's happening?129+-------------------------------------------130 131-If the debugsupport module is not compiled and you are using a Python132-installation without ctypes (Python 2.4 without ctypes, Jython or Google's133-AppEngine) Jinja is unable to provide correct debugging information and134-the traceback may be incomplete. There is currently no good workaround135-for Jython or the AppEngine as ctypes is unavailable there and it's not136-possible to use the debugsupport extension.131+Jinja can rewrite tracebacks so they show the template lines numbers and132+source rather than the underlying compiled code, but this requires133+special Python support. CPython <3.7 requires ``ctypes``, and PyPy134+requires transparent proxy support.135 138-If you are working in the Google AppEngine development server you can139-whitelist the ctypes module to restore the tracebacks. This however won't140-work in production environments::136+If you are using Google App Engine, ``ctypes`` is not available. You can137+make it available in development, but not in production.138 139+.. code-block:: python140+141 import os142 if os.environ.get('SERVER_SOFTWARE', '').startswith('Dev'):143 from google.appengine.tools.devappserver2.python import sandbox144 sandbox._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt']145 146 Credit for this snippet goes to `Thomas Johansson147 <https://stackoverflow.com/questions/3086091/debug-jinja2-in-google-app-engine/3694434#3694434>`_148 150-Why is there no Python 2.3/2.4/2.5/2.6/3.1/3.2/3.3 support?151------------------------------------------------------------152-153-Python 2.3 is missing a lot of features that are used heavily in Jinja. This154-decision was made as with the upcoming Python 2.6 and 3.0 versions it becomes155-harder to maintain the code for older Python versions. If you really need156-Python 2.3 support you either have to use Jinja 1 or other templating157-engines that still support 2.3.158-159-Python 2.4/2.5/3.1/3.2 support was removed when we switched to supporting160-Python 2 and 3 by the same sourcecode (without using 2to3). It was required to161-drop support because only Python 2.6/2.7 and >=3.3 support byte and unicode162-literals in a way compatible to each other version. If you really need support163-for older Python 2 (or 3) versions, you can just use Jinja 2.6.164-165-Python 2.6/3.3 support was dropped because it got dropped in various upstream166-projects (such as wheel or pytest), which would make it difficult to continue167-supporting it. Jinja 2.10 was the last version supporting Python 2.6/3.3.168-149 My Macros are overridden by something150 -------------------------------------151 152 In some situations the Jinja scoping appears arbitrary:23 unmodified linesmodified:docs/index.rst+3 added-26 removed
5 unmodified lines6 .. image:: _static/jinja-logo.png7 :align: center8 :target: https://palletsprojects.com/p/jinja/9 10-Jinja is a modern and designer-friendly templating language for Python,11-modelled after Django's templates. It is fast, widely used and secure12-with the optional sandboxed template execution environment:10+Jinja is a fast, expressive, extensible templating engine. Special11+placeholders in the template allow writing code similar to Python12+syntax. Then the template is passed data to render the final document.13 14-.. sourcecode:: html+jinja15-16- <title>{% block title %}{% endblock %}</title>17- <ul>18- {% for user in users %}19- <li><a href="{{ user.url }}">{{ user.username }}</a></li>20- {% endfor %}21- </ul>22-23-Features:24-25-- sandboxed execution26-- powerful automatic HTML escaping system for XSS prevention27-- template inheritance28-- compiles down to the optimal python code just in time29-- optional ahead-of-time template compilation30-- easy to debug. Line numbers of exceptions directly point to31- the correct line in the template.32-- configurable syntax33-14 .. toctree::15 :maxdepth: 216 :caption: Contents:17 7 unmodified lines25 switching26 tricks27 faq28 changelog49-50-* :ref:`genindex`51-* :ref:`search`modified:docs/intro.rst+37 added-56 removed
1 Introduction2 ============3 4-This is the documentation for the Jinja general purpose templating language.5-Jinja is a library for Python that is designed to be flexible, fast and secure.4+Jinja is a fast, expressive, extensible templating engine. Special5+placeholders in the template allow writing code similar to Python6+syntax. Then the template is passed data to render the final document.7 7-If you have any exposure to other text-based template languages, such as Smarty or8-Django, you should feel right at home with Jinja. It's both designer and9-developer friendly by sticking to Python's principles and adding functionality10-useful for templating environments.8+It includes:9 12-Prerequisites13--------------10+- Template inheritance and inclusion.11+- Define and import macros within templates.12+- HTML templates can use autoescaping to prevent XSS from untrusted13+ user input.14+- A sandboxed environment can safely render untrusted templates.15+- AsyncIO support for generating templates and calling async16+ functions.17+- I18N support with Babel.18+- Templates are compiled to optimized Python code just-in-time and19+ cached, or can be compiled ahead-of-time.20+- Exceptions point to the correct line in templates to make debugging21+ easier.22+- Extensible filters, tests, functions, and even syntax.23 15-Jinja works with Python 2.7.x and >= 3.5. If you are using Python16-3.2 you can use an older release of Jinja (2.6) as support for Python 3.217-was dropped in Jinja version 2.7. The last release which supported Python 2.618-and 3.3 was Jinja 2.10.24+Jinja's philosophy is that while application logic belongs in Python if25+possible, it shouldn't make the template designer's job difficult by26+restricting functionality too much.27 20-If you wish to use the :class:`~jinja2.PackageLoader` class, you will also21-need `setuptools`_ or `distribute`_ installed at runtime.28 29 Installation30 ------------31 26-You can install the most recent Jinja version using `pip`_::32+We recommend using the latest version of Python. Jinja supports Python33+3.6 and newer. We also recommend using a `virtual environment`_ in order34+to isolate your project dependencies from other projects and the system.35 28- pip install Jinja236+.. _virtual environment: https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments37 30-This will install Jinja in your Python installation's site-packages directory.38+Install the most recent Jinja version using pip:39 32-Installing the development version33-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~40+.. code-block:: text41 35-1. Install `git`_36-2. ``git clone git://github.com/pallets/jinja.git``37-3. ``cd jinja2``38-4. ``ln -s jinja2 /usr/lib/python2.X/site-packages``42+ $ pip install Jinja243 40-As an alternative to steps 4 you can also do ``python setup.py develop``41-which will install the package via `distribute` in development mode. This also42-has the advantage that the C extensions are compiled.44 44-.. _distribute: https://pypi.org/project/distribute/45-.. _setuptools: https://pypi.org/project/setuptools/46-.. _pip: https://pypi.org/project/pip/47-.. _git: https://git-scm.com/45+Dependencies46+~~~~~~~~~~~~47 48+These will be installed automatically when installing Jinja.49 50-MarkupSafe Dependency51-~~~~~~~~~~~~~~~~~~~~~50+- `MarkupSafe`_ escapes untrusted input when rendering templates to51+ avoid injection attacks.52 53-As of version 2.7 Jinja depends on the `MarkupSafe`_ module. If you install54-Jinja via ``pip`` it will be installed automatically for you.55-53 .. _MarkupSafe: https://markupsafe.palletsprojects.com/54 58-Basic API Usage59----------------55 61-This section gives you a brief introduction to the Python API for Jinja62-templates.56+Optional Dependencies57+~~~~~~~~~~~~~~~~~~~~~58 64-The most basic way to create a template and render it is through65-:class:`~jinja2.Template`. This however is not the recommended way to66-work with it if your templates are not loaded from strings but the file67-system or another data source:59+These distributions will not be installed automatically.60 69->>> from jinja2 import Template70->>> template = Template('Hello {{ name }}!')71->>> template.render(name='John Doe')72-u'Hello John Doe!'61+- `Babel`_ provides translation support in templates.62 74-By creating an instance of :class:`~jinja2.Template` you get back a new template75-object that provides a method called :meth:`~jinja2.Template.render` which when76-called with a dict or keyword arguments expands the template. The dict77-or keywords arguments passed to the template are the so-called "context"78-of the template.79-80-What you can see here is that Jinja is using unicode internally and the81-return value is an unicode string. So make sure that your application is82-indeed using unicode internally.63+.. _Babel: http://babel.pocoo.org/modified:docs/switching.rst+6 added-6 removed
30 unmodified lines31 provides a :class:`Template` class that can be used to do the same, but32 with optional additional configuration.33 34 Automatic unicode conversion35- Jinja 1 performed automatic conversion of bytestrings in a given encoding36- into unicode objects. This conversion is no longer implemented as it37- was inconsistent as most libraries are using the regular Python ASCII38- bytestring to Unicode conversion. An application powered by Jinja 239- *has to* use unicode internally everywhere or make sure that Jinja 2 only40- gets unicode strings passed.35+ Jinja 1 performed automatic conversion of bytes in a given encoding36+ into unicode objects. This conversion is no longer implemented as it37+ was inconsistent as most libraries are using the regular Python38+ ASCII bytes to Unicode conversion. An application powered by Jinja 239+ *has to* use unicode internally everywhere or make sure that Jinja 240+ only gets unicode strings passed.41 42 i18n43 Jinja 1 used custom translators for internationalization. i18n is now44 available as Jinja 2 extension and uses a simpler, more gettext friendly182 unmodified linesmodified:docs/templates.rst+2 added-3 removed
600 unmodified lines601 602 Jinja functions (macros, `super`, `self.BLOCKNAME`) always return template603 data that is marked as safe.604 605-String literals in templates with automatic escaping are considered unsafe606-because native Python strings (``str``, ``unicode``, ``basestring``) are not607-`MarkupSafe.Markup` strings with an ``__html__`` attribute.605+String literals in templates with automatic escaping are considered606+unsafe because native Python strings are not safe.607 608 .. _list-of-control-structures:609 610 List of Control Structures1209 unmodified linesmodified:src/jinja2/bccache.py+1 added-1 removed
282 unmodified lines283 - `cachelib <https://github.com/pallets/cachelib>`_284 - `python-memcached <https://pypi.org/project/python-memcached/>`_285 286 (Unfortunately the django cache interface is not compatible because it287- does not support storing binary data, only unicode. You can however pass287+ does not support storing binary data, only text. You can however pass288 the underlying cache client to the bytecode cache which is available289 as `django.core.cache.cache._client`.)290 291 The minimal interface for the client passed to the constructor is this:59 unmodified linesmodified:src/jinja2/environment.py+6 added-6 removed
1079 unmodified lines1080 1081 template.render(knights='that say nih')1082 template.render({'knights': 'that say nih'})1083 1084- This will return the rendered template as unicode string.1084+ This will return the rendered template as a string.1085 """1086 vars = dict(*args, **kwargs)1087 try:1088 return concat(self.root_render_func(self.new_context(vars)))23 unmodified lines1112 def generate(self, *args, **kwargs):1113 """For very large templates it can be useful to not render the whole1114 template at once but evaluate each statement after another and yield1115 piece for piece. This method basically does exactly that and returns1116- a generator that yields one item after another as unicode strings.1116+ a generator that yields one item after another as strings.1117 1118 It accepts the same arguments as :meth:`render`.1119 """1120 vars = dict(*args, **kwargs)101 unmodified lines1222 @implements_to_string1223 class TemplateModule(object):1224 """Represents an imported template. All the exported names of the1225 template are available as attributes on this object. Additionally1226- converting it into an unicode- or bytestrings renders the contents.1226+ converting it into a string renders the contents.1227 """1228 1229 def __init__(self, template, context, body_stream=None):1230 if body_stream is None:46 unmodified lines1277 class TemplateStream(object):1278 """A template stream works pretty much like an ordinary python generator1279 but it can buffer multiple items to reduce the number of total iterations.1280 Per default the output is unbuffered which means that for every unbuffered1281- instruction in the template one unicode string is yielded.1281+ instruction in the template one string is yielded.1282 1283 If buffering is enabled with a buffer size of 5, five items are combined1284- into a new unicode string. This is mainly useful if you are streaming1284+ into a new string. This is mainly useful if you are streaming1285 big templates to a client via WSGI which flushes after each iteration.1286 """1287 1288 def __init__(self, gen):1 unmodified line1290 self.disable_buffering()1291 1292 def dump(self, fp, encoding=None, errors="strict"):1293 """Dump the complete stream into a file or file-like object.1294- Per default unicode strings are written, if you want to encode1294+ Per default strings are written, if you want to encode1295 before writing specify an `encoding`.1296 1297 Example usage::1298 64 unmodified linesmodified:src/jinja2/ext.py+2 added-2 removed
536 unmodified lines537 538 * ``lineno`` is the number of the line on which the string was found,539 * ``function`` is the name of the ``gettext`` function used (if the540 string was extracted from embedded Python code), and541- * ``message`` is the string itself (a ``unicode`` object, or a tuple542- of ``unicode`` objects for functions with multiple string arguments).541+ * ``message`` is the string, or a tuple of strings for functions542+ with multiple string arguments.543 544 This extraction function operates on the AST and is because of that unable545 to extract any comments. For comment support you have to use the babel546 extraction interface or extract comments yourself.158 unmodified linesmodified:src/jinja2/lexer.py+3 added-1 removed
605 unmodified lines606 ],607 }608 609 def _normalize_newlines(self, value):610- """Called for strings and template data to normalize it to unicode."""610+ """Replace all newlines with the configured sequence in strings611+ and template data.612+ """613 return newline_re.sub(self.newline_sequence, value)614 615 def tokenize(self, source, name=None, filename=None, state=None):616 """Calls tokeniter + tokenize and wraps it in a token stream."""227 unmodified linesmodified:src/jinja2/loaders.py+6 added-6 removed
75 unmodified lines76 tuple in the form ``(source, filename, uptodate)`` or raise a77 `TemplateNotFound` error if it can't locate the template.78 79 The source part of the returned tuple must be the source of the80- template as unicode string or a ASCII bytestring. The filename should81- be the name of the file on the filesystem if it was loaded from there,82- otherwise `None`. The filename is used by python for the tracebacks80+ template as a string. The filename should be the name of the81+ file on the filesystem if it was loaded from there, otherwise82+ ``None``. The filename is used by Python for the tracebacks83 if no loader extension is used.84 85 The last item in the tuple is the `uptodate` function. If auto86 reloading is enabled it's always called to check if the template269 unmodified lines356 return results357 358 359 class DictLoader(BaseLoader):360- """Loads a template from a python dict. It's passed a dict of unicode361- strings bound to template names. This loader is useful for unittesting:360+ """Loads a template from a Python dict mapping template names to361+ template source. This loader is useful for unittesting:362 363 >>> loader = DictLoader({'index.html': 'source here'})364 365 Because auto reloading is rarely useful this is disabled per default.14 unmodified lines380 381 class FunctionLoader(BaseLoader):382 """A loader that is passed a function which does the loading. The383 function receives the name of the template and has to return either384- an unicode string with the template source, a tuple in the form ``(source,384+ a string with the template source, a tuple in the form ``(source,385 filename, uptodatefunc)`` or `None` if the template does not exist.386 387 >>> def load_template(name):388 ... if name == 'index.html':184 unmodified linesmodified:src/jinja2/nodes.py+2 added-2 removed
786 unmodified lines787 return slice(const(self.start), const(self.stop), const(self.step))788 789 790 class Concat(Expr):791- """Concatenates the list of expressions provided after converting them to792- unicode.791+ """Concatenates the list of expressions provided after converting792+ them to strings.793 """794 795 fields = ("nodes",)796 292 unmodified linesmodified:src/jinja2/runtime.py+2 added-2 removed
58 unmodified lines59 return x60 61 62 def markup_join(seq):63- """Concatenation that escapes if necessary and converts to unicode."""63+ """Concatenation that escapes if necessary and converts to string."""64 buf = []65 iterator = imap(soft_unicode, seq)66 for arg in iterator:67 buf.append(arg)2 unmodified lines70 return concat(buf)71 72 73 def unicode_join(seq):74- """Simple args to unicode conversion and concatenation."""74+ """Simple args to string conversion and concatenation."""75 return concat(imap(text_type, seq))76 77 78 def new_context(933 unmodified linesmodified:src/jinja2/sandbox.py+1 added-2 removed
242 unmodified lines243 True244 >>> modifies_known_mutable([], "index")245 False246 247- If called with an unsupported object (such as unicode) `False` is248- returned.247+ If called with an unsupported object, ``False`` is returned.248 249 >>> modifies_known_mutable("foo", "upper")250 False251 """258 unmodified lines