]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
rename imports to jinja
authorDavid Lord <davidism@gmail.com>
Fri, 10 Jan 2020 22:19:48 +0000 (14:19 -0800)
committerDavid Lord <davidism@gmail.com>
Fri, 10 Jan 2020 23:30:16 +0000 (15:30 -0800)
57 files changed:
CHANGES.rst
README.rst
docs/api.rst
docs/conf.py
docs/examples/cache_extension.py
docs/examples/inline_gettext_extension.py
docs/extensions.rst
docs/faq.rst
docs/integration.rst
docs/intro.rst
docs/nativetypes.rst
docs/sandbox.rst
docs/templates.rst
examples/basic/cycle.py
examples/basic/debugger.py
examples/basic/inheritance.py
examples/basic/test.py
examples/basic/test_filter_and_linestatements.py
examples/basic/test_loop_filter.py
examples/basic/translate.py
scripts/generate_identifier_pattern.py
setup.cfg
setup.py
src/jinja/bccache.py
src/jinja/compiler.py
src/jinja/environment.py
src/jinja/ext.py
src/jinja/filters.py
src/jinja/lexer.py
src/jinja/loaders.py
src/jinja/meta.py
src/jinja/nodes.py
src/jinja/parser.py
src/jinja/runtime.py
src/jinja/sandbox.py
src/jinja/utils.py
tests/conftest.py
tests/test_api.py
tests/test_async.py
tests/test_asyncfilters.py
tests/test_bytecode_cache.py
tests/test_core_tags.py
tests/test_debug.py
tests/test_ext.py
tests/test_features.py
tests/test_filters.py
tests/test_idtracking.py
tests/test_imports.py
tests/test_inheritance.py
tests/test_lexnparse.py
tests/test_loader.py
tests/test_nativetypes.py
tests/test_regression.py
tests/test_runtime.py
tests/test_security.py
tests/test_tests.py
tests/test_utils.py

index 889fd9a102dbc537d647fa95ac5f7ececf6154bf..9c2208e096f65f167eb9d044aaea06ce10efab20 100644 (file)
@@ -20,7 +20,7 @@ Unreleased
 -   Fix a bug causing deadlocks in ``LRUCache.setdefault``. :pr:`1000`
 -   The ``trim`` filter takes an optional string of characters to trim.
     :pr:`828`
--   A new ``jinja2.ext.debug`` extension adds a ``{% debug %}`` tag to
+-   A new ``jinja.ext.debug`` extension adds a ``{% debug %}`` tag to
     quickly dump the current context and available filters and tests.
     :issue:`174`, :pr:`798, 983`
 -   Lexing templates with large amounts of whitespace is much faster.
@@ -364,11 +364,9 @@ Released 2015-07-26, codename Replacement
     arguments. This change makes ``{% macro m(x, y=1, z) %}`` a syntax
     error. The previous behavior for this code was broken anyway
     (resulting in the default value being applied to ``y``).
--   Add ability to use custom subclasses of
-    ``jinja2.compiler.CodeGenerator`` and ``jinja2.runtime.Context`` by
-    adding two new attributes to the environment
-    (``code_generator_class`` and ``context_class``) (pull request
-    ``:issue:`404```).
+-   Add ability to use custom subclasses of ``CodeGenerator`` and
+    ``Context`` by adding two new attributes to the environment
+    (``code_generator_class`` and ``context_class``). :pr:`404`
 -   Added support for context/environment/evalctx decorator functions on
     the finalize callback of the environment.
 -   Escape query strings for urlencode properly. Previously slashes were
@@ -559,7 +557,6 @@ Released 2010-05-29, codename Incoherence
 -   Fixed a bug for getattribute constant folding.
 -   Support for newstyle gettext translations which result in a nicer
     in-template user interface and more consistent catalogs.
-    (:ref:`newstyle-gettext`)
 -   It's now possible to register extensions after an environment was
     created.
 
@@ -587,7 +584,7 @@ Released 2010-04-13, codename Correlation
     folder.
 -   The _speedups C extension now supports Python 3.
 -   Added support for autoescaping toggling sections and support for
-    evaluation contexts (:ref:`eval-context`).
+    evaluation contexts.
 -   Extensions have a priority now.
 
 
@@ -689,7 +686,7 @@ Released 2008-11-23, codename Yasuzō
 -   Added ``sort`` filter that works like ``dictsort`` but for arbitrary
     sequences.
 -   Fixed a bug with empty statements in macros.
--   Implemented a bytecode cache system. (:ref:`bytecode-cache`)
+-   Implemented a bytecode cache system.
 -   The template context is now weakref-able
 -   Inclusions and imports "with context" forward all variables now, not
     only the initial context.
@@ -709,13 +706,11 @@ Released 2008-07-17, codename Jinjavitus
     from slightly. It's now possible to give attributes or items a
     higher priority by either using dot-notation lookup or the bracket
     syntax. This also changed the AST slightly. ``Subscript`` is gone
-    and was replaced with :class:`~jinja2.nodes.Getitem` and
-    :class:`~jinja2.nodes.Getattr`. For more information see :ref:`the
-    implementation details <notes-on-subscriptions>`.
+    and was replaced with ``Getitem`` and ``Getattr``.
 -   Added support for preprocessing and token stream filtering for
     extensions. This would allow extensions to allow simplified gettext
     calls in template data and something similar.
--   Added :meth:`jinja2.environment.TemplateStream.dump`.
+-   Added ``TemplateStream.dump``.
 -   Added missing support for implicit string literal concatenation.
     ``{{ "foo" "bar" }}`` is equivalent to ``{{ "foobar" }}``
 -   ``else`` is optional for conditional expressions. If not given it
index 060b19efee615b2ac57f3c08f8ecb3cfb6f38f6a..1eb9cece8a3cb5be84b92959f8484f13b2182cf3 100644 (file)
@@ -33,7 +33,7 @@ Install and update using `pip`_:
 
 .. code-block:: text
 
-    $ pip install -U Jinja2
+    $ pip install -U Jinja
 
 .. _pip: https://pip.pypa.io/en/stable/quickstart/
 
@@ -59,7 +59,7 @@ Links
 
 -   Website: https://palletsprojects.com/p/jinja/
 -   Documentation: https://jinja.palletsprojects.com/
--   Releases: https://pypi.org/project/Jinja2/
+-   Releases: https://pypi.org/project/Jinja/
 -   Code: https://github.com/pallets/jinja
 -   Issue tracker: https://github.com/pallets/jinja/issues
 -   Test status: https://dev.azure.com/pallets/jinja/_build
index 871b326f519a60cbe852db5683a519f4c71193ff..d1a0a2e66785b5cfed49db16060c6883f7f3c43c 100644 (file)
@@ -1,7 +1,7 @@
 API
 ===
 
-.. module:: jinja2
+.. module:: jinja
     :noindex:
     :synopsis: public Jinja API
 
@@ -27,7 +27,7 @@ are in use.
 The simplest way to configure Jinja to load templates for your application
 looks roughly like this::
 
-    from jinja2 import Environment, PackageLoader, select_autoescape
+    from jinja import Environment, PackageLoader, select_autoescape
     env = Environment(
         loader=PackageLoader('yourapplication', 'templates'),
         autoescape=select_autoescape(['html', 'xml'])
@@ -142,7 +142,7 @@ useful if you want to dig deeper into Jinja or :ref:`develop extensions
 
         If the environment is sandboxed this attribute is `True`.  For the
         sandbox mode have a look at the documentation for the
-        :class:`~jinja2.sandbox.SandboxedEnvironment`.
+        :class:`~jinja.sandbox.SandboxedEnvironment`.
 
     .. attribute:: filters
 
@@ -182,7 +182,7 @@ useful if you want to dig deeper into Jinja or :ref:`develop extensions
        The context used for templates.  This should not be changed
        in most cases, unless you need to modify internals of how
        template variables are handled.  For details, see
-       :class:`~jinja2.runtime.Context`.
+       :class:`~jinja.runtime.Context`.
 
     .. automethod:: overlay([options])
 
@@ -251,7 +251,7 @@ useful if you want to dig deeper into Jinja or :ref:`develop extensions
     .. automethod:: generate_async([context])
 
 
-.. autoclass:: jinja2.environment.TemplateStream()
+.. autoclass:: jinja.environment.TemplateStream()
     :members: disable_buffering, enable_buffering, dump
 
 
@@ -267,14 +267,14 @@ future.  It's recommended to configure a sensible default for
 autoescaping.  This makes it possible to enable and disable autoescaping
 on a per-template basis (HTML versus text for instance).
 
-.. autofunction:: jinja2.select_autoescape
+.. autofunction:: jinja.select_autoescape
 
 Here a recommended setup that enables autoescaping for templates ending
 in ``'.html'``, ``'.htm'`` and ``'.xml'`` and disabling it by default
-for all other extensions.  You can use the :func:`~jinja2.select_autoescape`
+for all other extensions.  You can use the :func:`~jinja.select_autoescape`
 function for this::
 
-    from jinja2 import Environment, select_autoescape
+    from jinja import Environment, select_autoescape
     env = Environment(autoescape=select_autoescape(['html', 'htm', 'xml']),
                       loader=PackageLoader('mypackage'))
 
@@ -324,7 +324,7 @@ others fail.
 The closest to regular Python behavior is the :class:`StrictUndefined` which
 disallows all operations beside testing if it's an undefined object.
 
-.. autoclass:: jinja2.Undefined()
+.. autoclass:: jinja.Undefined()
 
     .. attribute:: _undefined_hint
 
@@ -352,16 +352,16 @@ disallows all operations beside testing if it's an undefined object.
         :attr:`_undefined_exception` with an error message generated
         from the undefined hints stored on the undefined object.
 
-.. autoclass:: jinja2.ChainableUndefined()
+.. autoclass:: jinja.ChainableUndefined()
 
-.. autoclass:: jinja2.DebugUndefined()
+.. autoclass:: jinja.DebugUndefined()
 
-.. autoclass:: jinja2.StrictUndefined()
+.. autoclass:: jinja.StrictUndefined()
 
 There is also a factory function that can decorate undefined objects to
 implement logging on failures:
 
-.. autofunction:: jinja2.make_logging_undefined
+.. autofunction:: jinja.make_logging_undefined
 
 Undefined objects are created by calling :attr:`undefined`.
 
@@ -393,7 +393,7 @@ Undefined objects are created by calling :attr:`undefined`.
 The Context
 -----------
 
-.. autoclass:: jinja2.runtime.Context()
+.. autoclass:: jinja.runtime.Context()
     :members: resolve, get_exported, get_all
 
     .. attribute:: parent
@@ -437,7 +437,7 @@ The Context
 
         The current :ref:`eval-context`.
 
-    .. automethod:: jinja2.runtime.Context.call(callable, \*args, \**kwargs)
+    .. automethod:: jinja.runtime.Context.call(callable, \*args, \**kwargs)
 
 
 .. admonition:: Implementation
@@ -464,24 +464,24 @@ size by default and templates are automatically reloaded.
 All loaders are subclasses of :class:`BaseLoader`.  If you want to create your
 own loader, subclass :class:`BaseLoader` and override `get_source`.
 
-.. autoclass:: jinja2.BaseLoader
+.. autoclass:: jinja.BaseLoader
     :members: get_source, load
 
 Here a list of the builtin loaders Jinja provides:
 
-.. autoclass:: jinja2.FileSystemLoader
+.. autoclass:: jinja.FileSystemLoader
 
-.. autoclass:: jinja2.PackageLoader
+.. autoclass:: jinja.PackageLoader
 
-.. autoclass:: jinja2.DictLoader
+.. autoclass:: jinja.DictLoader
 
-.. autoclass:: jinja2.FunctionLoader
+.. autoclass:: jinja.FunctionLoader
 
-.. autoclass:: jinja2.PrefixLoader
+.. autoclass:: jinja.PrefixLoader
 
-.. autoclass:: jinja2.ChoiceLoader
+.. autoclass:: jinja.ChoiceLoader
 
-.. autoclass:: jinja2.ModuleLoader
+.. autoclass:: jinja.ModuleLoader
 
 
 .. _bytecode-cache:
@@ -499,10 +499,10 @@ the application.
 
 To use a bytecode cache, instantiate it and pass it to the :class:`Environment`.
 
-.. autoclass:: jinja2.BytecodeCache
+.. autoclass:: jinja.BytecodeCache
     :members: load_bytecode, dump_bytecode, clear
 
-.. autoclass:: jinja2.bccache.Bucket
+.. autoclass:: jinja.bccache.Bucket
     :members: write_bytecode, load_bytecode, bytecode_from_string,
               bytecode_to_string, reset
 
@@ -521,9 +521,9 @@ To use a bytecode cache, instantiate it and pass it to the :class:`Environment`.
 
 Builtin bytecode caches:
 
-.. autoclass:: jinja2.FileSystemBytecodeCache
+.. autoclass:: jinja.FileSystemBytecodeCache
 
-.. autoclass:: jinja2.MemcachedBytecodeCache
+.. autoclass:: jinja.MemcachedBytecodeCache
 
 
 Async Support
@@ -569,7 +569,7 @@ Policies
 Starting with Jinja 2.9 policies can be configured on the environment
 which can slightly influence how filters and other template constructs
 behave.  They can be configured with the
-:attr:`~jinja2.Environment.policies` attribute.
+:attr:`~jinja.Environment.policies` attribute.
 
 Example::
 
@@ -626,17 +626,17 @@ Utilities
 These helper functions and classes are useful if you add custom filters or
 functions to a Jinja environment.
 
-.. autofunction:: jinja2.environmentfilter
+.. autofunction:: jinja.environmentfilter
 
-.. autofunction:: jinja2.contextfilter
+.. autofunction:: jinja.contextfilter
 
-.. autofunction:: jinja2.evalcontextfilter
+.. autofunction:: jinja.evalcontextfilter
 
-.. autofunction:: jinja2.environmentfunction
+.. autofunction:: jinja.environmentfunction
 
-.. autofunction:: jinja2.contextfunction
+.. autofunction:: jinja.contextfunction
 
-.. autofunction:: jinja2.evalcontextfunction
+.. autofunction:: jinja.evalcontextfunction
 
 .. function:: escape(s)
 
@@ -647,11 +647,11 @@ functions to a Jinja environment.
 
     The return value is a :class:`Markup` string.
 
-.. autofunction:: jinja2.clear_caches
+.. autofunction:: jinja.clear_caches
 
-.. autofunction:: jinja2.is_undefined
+.. autofunction:: jinja.is_undefined
 
-.. autoclass:: jinja2.Markup([string])
+.. autoclass:: jinja.Markup([string])
     :members: escape, unescape, striptags
 
 .. admonition:: Note
@@ -664,15 +664,15 @@ functions to a Jinja environment.
 Exceptions
 ----------
 
-.. autoexception:: jinja2.TemplateError
+.. autoexception:: jinja.TemplateError
 
-.. autoexception:: jinja2.UndefinedError
+.. autoexception:: jinja.UndefinedError
 
-.. autoexception:: jinja2.TemplateNotFound
+.. autoexception:: jinja.TemplateNotFound
 
-.. autoexception:: jinja2.TemplatesNotFound
+.. autoexception:: jinja.TemplatesNotFound
 
-.. autoexception:: jinja2.TemplateSyntaxError
+.. autoexception:: jinja.TemplateSyntaxError
 
     .. attribute:: message
 
@@ -695,9 +695,9 @@ Exceptions
     unicode strings is that Python 2.x is not using unicode for exceptions
     and tracebacks as well as the compiler.  This will change with Python 3.
 
-.. autoexception:: jinja2.TemplateRuntimeError
+.. autoexception:: jinja.TemplateRuntimeError
 
-.. autoexception:: jinja2.TemplateAssertionError
+.. autoexception:: jinja.TemplateAssertionError
 
 
 .. _writing-filters:
@@ -739,7 +739,7 @@ paragraphs and marks the return value as safe HTML string if autoescaping is
 enabled::
 
     import re
-    from jinja2 import evalcontextfilter, Markup, escape
+    from jinja import evalcontextfilter, Markup, escape
 
     _paragraph_re = re.compile(r'(?:\r\n|\r(?!\n)|\n){2,}')
 
@@ -805,7 +805,7 @@ must only happen with a :class:`nodes.EvalContextModifier` and
 :class:`nodes.ScopedEvalContextModifier` from an extension, not on the
 eval context object itself.
 
-.. autoclass:: jinja2.nodes.EvalContext
+.. autoclass:: jinja.nodes.EvalContext
 
    .. attribute:: autoescape
 
@@ -928,6 +928,6 @@ could help applications to implement more advanced template concepts.  All
 the functions of the meta API operate on an abstract syntax tree as
 returned by the :meth:`Environment.parse` method.
 
-.. autofunction:: jinja2.meta.find_undeclared_variables
+.. autofunction:: jinja.meta.find_undeclared_variables
 
-.. autofunction:: jinja2.meta.find_referenced_templates
+.. autofunction:: jinja.meta.find_referenced_templates
index 01e530dc89432237bfda5bbb204e5ac6d358ff54..1562509b972e2a0eaea9d6bcddf0fdea505c49d5 100644 (file)
@@ -6,7 +6,7 @@ from pallets_sphinx_themes import ProjectLink
 project = "Jinja"
 copyright = "2007 Pallets"
 author = "Pallets"
-release, version = get_version("Jinja2")
+release, version = get_version("Jinja")
 
 # General --------------------------------------------------------------
 
@@ -29,7 +29,7 @@ html_context = {
     "project_links": [
         ProjectLink("Donate to Pallets", "https://palletsprojects.com/donate"),
         ProjectLink("Jinja Website", "https://palletsprojects.com/p/jinja/"),
-        ProjectLink("PyPI releases", "https://pypi.org/project/Jinja2/"),
+        ProjectLink("PyPI releases", "https://pypi.org/project/Jinja/"),
         ProjectLink("Source Code", "https://github.com/pallets/jinja/"),
         ProjectLink("Issue Tracker", "https://github.com/pallets/jinja/issues/"),
     ]
index 387cd465790be78c258304c67b24962e949ef73f..f6541c0007d06a8040e4c687896fd38ab58a3845 100644 (file)
@@ -1,5 +1,5 @@
-from jinja2 import nodes
-from jinja2.ext import Extension
+from jinja import nodes
+from jinja.ext import Extension
 
 
 class FragmentCacheExtension(Extension):
index 47bc9cc1c27f78db5777f6a378748c23c8ebe377..61b525a45181a2e122ecc1f0d06487ff13f593bd 100644 (file)
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
 import re
 
-from jinja2.exceptions import TemplateSyntaxError
-from jinja2.ext import Extension
-from jinja2.lexer import count_newlines
-from jinja2.lexer import Token
+from jinja.exceptions import TemplateSyntaxError
+from jinja.ext import Extension
+from jinja.lexer import count_newlines
+from jinja.lexer import Token
 
 
 _outside_re = re.compile(r"\\?(gettext|_)\(")
index 7abed658b1a3bd12a518580a2d7ae43a6df6a5ee..37eb732af96279ccf390cf63569e897cbe47eb99 100644 (file)
@@ -14,10 +14,10 @@ Adding Extensions
 Extensions are added to the Jinja environment at creation time.  Once the
 environment is created additional extensions cannot be added.  To add an
 extension pass a list of extension classes or import paths to the
-``extensions`` parameter of the :class:`~jinja2.Environment` constructor.  The following
+``extensions`` parameter of the :class:`~jinja.Environment` constructor.  The following
 example creates a Jinja environment with the i18n extension loaded::
 
-    jinja_env = Environment(extensions=['jinja2.ext.i18n'])
+    jinja_env = Environment(extensions=['jinja.ext.i18n'])
 
 
 .. _i18n-extension:
@@ -25,7 +25,7 @@ example creates a Jinja environment with the i18n extension loaded::
 i18n Extension
 --------------
 
-**Import name:** ``jinja2.ext.i18n``
+**Import name:** ``jinja.ext.i18n``
 
 The i18n extension can be used in combination with `gettext`_ or
 `Babel`_.  When it's enabled, Jinja provides a ``trans`` statement that
@@ -41,7 +41,7 @@ Environment Methods
 After enabling the extension, the environment provides the following
 additional methods:
 
-.. method:: jinja2.Environment.install_gettext_translations(translations, newstyle=False)
+.. method:: jinja.Environment.install_gettext_translations(translations, newstyle=False)
 
     Installs a translation globally for the environment. The
     ``translations`` object must implement ``gettext`` and ``ngettext``
@@ -51,7 +51,7 @@ additional methods:
 
     .. versionchanged:: 2.5 Added new-style gettext support.
 
-.. method:: jinja2.Environment.install_null_translations(newstyle=False)
+.. method:: jinja.Environment.install_null_translations(newstyle=False)
 
     Install no-op gettext functions. This is useful if you want to
     prepare the application for internationalization but don't want to
@@ -59,7 +59,7 @@ additional methods:
 
     .. versionchanged:: 2.5 Added new-style gettext support.
 
-.. method:: jinja2.Environment.install_gettext_callables(gettext, ngettext, newstyle=False)
+.. method:: jinja.Environment.install_gettext_callables(gettext, ngettext, newstyle=False)
 
     Install the given ``gettext`` and ``ngettext`` callables into the
     environment. They should behave exactly like
@@ -71,11 +71,11 @@ additional methods:
 
     .. versionadded:: 2.5 Added new-style gettext support.
 
-.. method:: jinja2.Environment.uninstall_gettext_translations()
+.. method:: jinja.Environment.uninstall_gettext_translations()
 
     Uninstall the environment's globally installed translation.
 
-.. method:: jinja2.Environment.extract_translations(source)
+.. method:: jinja.Environment.extract_translations(source)
 
     Extract localizable strings from the given template node or source.
 
@@ -100,7 +100,7 @@ installed when the environment is created.
 .. code-block:: python
 
     translations = get_gettext_translations()
-    env = Environment(extensions=["jinja2.ext.i18n"])
+    env = Environment(extensions=["jinja.ext.i18n"])
     env.install_gettext_translations(translations)
 
 The ``get_gettext_translations`` function would return the translator
@@ -182,7 +182,7 @@ The advantages of newstyle gettext are:
 Expression Statement
 --------------------
 
-**Import name:** ``jinja2.ext.do``
+**Import name:** ``jinja.ext.do``
 
 The "do" aka expression-statement extension adds a simple ``do`` tag to the
 template engine that works like a variable expression but ignores the
@@ -193,7 +193,7 @@ return value.
 Loop Controls
 -------------
 
-**Import name:** ``jinja2.ext.loopcontrols``
+**Import name:** ``jinja.ext.loopcontrols``
 
 This extension adds support for ``break`` and ``continue`` in loops.  After
 enabling, Jinja provides those two keywords which work exactly like in
@@ -204,7 +204,7 @@ Python.
 With Statement
 --------------
 
-**Import name:** ``jinja2.ext.with_``
+**Import name:** ``jinja.ext.with_``
 
 .. versionchanged:: 2.9
 
@@ -215,7 +215,7 @@ With Statement
 Autoescape Extension
 --------------------
 
-**Import name:** ``jinja2.ext.autoescape``
+**Import name:** ``jinja.ext.autoescape``
 
 .. versionchanged:: 2.9
 
@@ -228,7 +228,7 @@ Autoescape Extension
 Debug Extension
 ---------------
 
-**Import name:** ``jinja2.ext.debug``
+**Import name:** ``jinja.ext.debug``
 
 Adds a ``{% debug %}`` tag to dump the current context as well as the
 available filters and tests. This is useful to see what's available to
@@ -240,7 +240,7 @@ use in the template without setting up a debugger.
 Writing Extensions
 ------------------
 
-.. module:: jinja2.ext
+.. module:: jinja.ext
 
 By writing extensions you can add custom tags to Jinja.  This is a non-trivial
 task and usually not needed as the default tags and expressions cover all
@@ -269,7 +269,7 @@ The following example implements a ``cache`` tag for Jinja by using the
 
 And here is how you use it in an environment::
 
-    from jinja2 import Environment
+    from jinja import Environment
     from cachelib import SimpleCache
 
     env = Environment(extensions=[FragmentCacheExtension])
@@ -313,7 +313,7 @@ Extension API
 Extension
 ~~~~~~~~~
 
-Extensions always have to extend the :class:`jinja2.ext.Extension` class:
+Extensions always have to extend the :class:`jinja.ext.Extension` class:
 
 .. autoclass:: Extension
     :members: preprocess, filter_stream, parse, attr, call_method
@@ -336,7 +336,7 @@ The parser passed to :meth:`Extension.parse` provides ways to parse
 expressions of different types.  The following methods may be used by
 extensions:
 
-.. autoclass:: jinja2.parser.Parser
+.. autoclass:: jinja.parser.Parser
     :members: parse_expression, parse_tuple, parse_assign_target,
               parse_statements, free_identifier, fail
 
@@ -353,16 +353,16 @@ extensions:
 
     .. attribute:: stream
 
-        The current :class:`~jinja2.lexer.TokenStream`
+        The current :class:`~jinja.lexer.TokenStream`
 
-.. autoclass:: jinja2.lexer.TokenStream
+.. autoclass:: jinja.lexer.TokenStream
    :members: push, look, eos, skip, __next__, next_if, skip_if, expect
 
    .. attribute:: current
 
-        The current :class:`~jinja2.lexer.Token`.
+        The current :class:`~jinja.lexer.Token`.
 
-.. autoclass:: jinja2.lexer.Token
+.. autoclass:: jinja.lexer.Token
     :members: test, test_any
 
     .. attribute:: lineno
@@ -381,7 +381,7 @@ extensions:
 There is also a utility function in the lexer module that can count newline
 characters in strings:
 
-.. autofunction:: jinja2.lexer.count_newlines
+.. autofunction:: jinja.lexer.count_newlines
 
 
 AST
@@ -395,10 +395,10 @@ execute custom Python code.
 The list below describes all nodes that are currently available.  The AST may
 change between Jinja versions but will stay backwards compatible.
 
-For more information have a look at the repr of :meth:`jinja2.Environment.parse`.
+For more information have a look at the repr of :meth:`jinja.Environment.parse`.
 
-.. module:: jinja2.nodes
+.. module:: jinja.nodes
 
-.. jinja:nodes:: jinja2.nodes.Node
+.. jinja:nodes:: jinja.nodes.Node
 
 .. autoexception:: Impossible
index 294fef1d66e2fe1af25e4719dde8291c10fe3e2c..da8436856fd52bebc6d05978316597947b4f5d96 100644 (file)
@@ -145,7 +145,7 @@ work in production environments::
         sandbox._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt']
 
 Credit for this snippet goes to `Thomas Johansson
-<https://stackoverflow.com/questions/3086091/debug-jinja2-in-google-app-engine/3694434#3694434>`_
+<https://stackoverflow.com/a/3694434>`_
 
 Why is there no Python 2.3/2.4/2.5/2.6/3.1/3.2/3.3 support?
 -----------------------------------------------------------
index 2cfad55f9773f712c7fb82419c2d2d3a274bcc9c..a7a6fe39fa08912fa6a056af079a2ddc7e8b0112 100644 (file)
@@ -14,7 +14,7 @@ Babel Integration
 -----------------
 
 Jinja provides support for extracting gettext messages from templates via a
-`Babel`_ extractor entry point called `jinja2.ext.babel_extract`.  The Babel
+`Babel`_ extractor entry point called `jinja.ext.babel_extract`.  The Babel
 support is implemented as part of the :ref:`i18n-extension` extension.
 
 Gettext messages extracted from both `trans` tags and code expressions.
@@ -24,7 +24,7 @@ in its Babel extraction method `mapping file`_:
 
 .. sourcecode:: ini
 
-    [jinja2: **/templates/**.html]
+    [jinja: **/templates/**.html]
     encoding = utf-8
 
 The syntax related options of the :class:`Environment` are also available as
@@ -33,7 +33,7 @@ that templates use ``%`` as `line_statement_prefix` you can use this code:
 
 .. sourcecode:: ini
 
-    [jinja2: **/templates/**.html]
+    [jinja: **/templates/**.html]
     encoding = utf-8
     line_statement_prefix = %
 
@@ -61,7 +61,7 @@ Pylons powered application.
 The template engine is configured in `config/environment.py`.  The configuration
 for Jinja looks something like that::
 
-    from jinja2 import Environment, PackageLoader
+    from jinja import Environment, PackageLoader
     config['pylons.app_globals'].jinja_env = Environment(
         loader=PackageLoader('yourapplication', 'templates')
     )
index c20c5e91016ea05defa85c7d6c14d37d091aab22..cf0fc7d9fc90d1c910a315c82b3286da5b332879 100644 (file)
@@ -9,51 +9,29 @@ Django, you should feel right at home with Jinja.  It's both designer and
 developer friendly by sticking to Python's principles and adding functionality
 useful for templating environments.
 
+
 Prerequisites
 -------------
 
-Jinja works with Python 2.7.x and >= 3.5.  If you are using Python
-3.2 you can use an older release of Jinja (2.6) as support for Python 3.2
-was dropped in Jinja version 2.7. The last release which supported Python 2.6
-and 3.3 was Jinja 2.10.
+Jinja works with Python >= 3.5 and 2.7.
+
+Jinja depends on `MarkupSafe`_. If you install via ``pip`` it will be
+installed automatically.
+
+.. _MarkupSafe: https://markupsafe.palletsprojects.com/
 
-If you wish to use the :class:`~jinja2.PackageLoader` class, you will also
-need `setuptools`_ or `distribute`_ installed at runtime.
 
 Installation
 ------------
 
 You can install the most recent Jinja version using `pip`_::
 
-    pip install Jinja2
+    pip install Jinja
 
 This will install Jinja in your Python installation's site-packages directory.
 
-Installing the development version
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-1.  Install `git`_
-2.  ``git clone git://github.com/pallets/jinja.git``
-3.  ``cd jinja2``
-4.  ``ln -s jinja2 /usr/lib/python2.X/site-packages``
-
-As an alternative to steps 4 you can also do ``python setup.py develop``
-which will install the package via `distribute` in development mode.  This also
-has the advantage that the C extensions are compiled.
-
-.. _distribute: https://pypi.org/project/distribute/
-.. _setuptools: https://pypi.org/project/setuptools/
 .. _pip: https://pypi.org/project/pip/
-.. _git: https://git-scm.com/
-
-
-MarkupSafe Dependency
-~~~~~~~~~~~~~~~~~~~~~
 
-As of version 2.7 Jinja depends on the `MarkupSafe`_ module. If you install
-Jinja via ``pip`` it will be installed automatically for you.
-
-.. _MarkupSafe: https://markupsafe.palletsprojects.com/
 
 Basic API Usage
 ---------------
@@ -62,17 +40,17 @@ This section gives you a brief introduction to the Python API for Jinja
 templates.
 
 The most basic way to create a template and render it is through
-:class:`~jinja2.Template`.  This however is not the recommended way to
+:class:`~jinja.Template`.  This however is not the recommended way to
 work with it if your templates are not loaded from strings but the file
 system or another data source:
 
->>> from jinja2 import Template
+>>> from jinja import Template
 >>> template = Template('Hello {{ name }}!')
 >>> template.render(name='John Doe')
 u'Hello John Doe!'
 
-By creating an instance of :class:`~jinja2.Template` you get back a new template
-object that provides a method called :meth:`~jinja2.Template.render` which when
+By creating an instance of :class:`~jinja.Template` you get back a new template
+object that provides a method called :meth:`~jinja.Template.render` which when
 called with a dict or keyword arguments expands the template.  The dict
 or keywords arguments passed to the template are the so-called "context"
 of the template.
index 1a08700b08124791b69ccc1e40f6e0a1499dfbd4..a5258aa7ff93e8f939504e13fc8c170cdeb39aae 100644 (file)
@@ -1,11 +1,11 @@
-.. module:: jinja2.nativetypes
+.. module:: jinja.nativetypes
 
 .. _nativetypes:
 
 Native Python Types
 ===================
 
-The default :class:`~jinja2.Environment` renders templates to strings. With
+The default :class:`~jinja.Environment` renders templates to strings. With
 :class:`NativeEnvironment`, rendering a template produces a native Python type.
 This is useful if you are using Jinja outside the context of creating text
 files. For example, your code may have an intermediate step where users may use
index 1222d0250583096bdfbf8309d47f9b171ff0d53b..bd8abcf0d7ad52fd6051fa40b1d32c64fa3512b8 100644 (file)
@@ -17,7 +17,7 @@ SecurityError: access to attribute 'func_code' of 'function' object is unsafe.
 API
 ---
 
-.. module:: jinja2.sandbox
+.. module:: jinja.sandbox
 
 .. autoclass:: SandboxedEnvironment([options])
     :members: is_safe_attribute, is_safe_callable, default_binop_table,
@@ -77,7 +77,7 @@ operator symbols into callbacks performing the default operator behavior.
 This example shows how the power (``**``) operator can be disabled in
 Jinja::
 
-    from jinja2.sandbox import SandboxedEnvironment
+    from jinja.sandbox import SandboxedEnvironment
 
 
     class MyEnvironment(SandboxedEnvironment):
index 89c2a50601769c33346ad9f13d51953319319f0d..f9504c1c1d6d593395f2e482f34d6d02606fcd6f 100644 (file)
@@ -1425,7 +1425,7 @@ is a bit contrived in the context of rendering a template):
 List of Builtin Filters
 -----------------------
 
-.. jinja:filters:: jinja2.defaults.DEFAULT_FILTERS
+.. jinja:filters:: jinja.defaults.DEFAULT_FILTERS
 
 
 .. _builtin-tests:
@@ -1433,7 +1433,7 @@ List of Builtin Filters
 List of Builtin Tests
 ---------------------
 
-.. jinja:tests:: jinja2.defaults.DEFAULT_TESTS
+.. jinja:tests:: jinja.defaults.DEFAULT_TESTS
 
 
 .. _builtin-globals:
@@ -1731,9 +1731,9 @@ without setting up a debugger.
 
 .. code-block:: text
 
-    {'context': {'cycler': <class 'jinja2.utils.Cycler'>,
+    {'context': {'cycler': <class 'jinja.utils.Cycler'>,
                  ...,
-                 'namespace': <class 'jinja2.utils.Namespace'>},
+                 'namespace': <class 'jinja.utils.Namespace'>},
      'filters': ['abs', 'attr', 'batch', 'capitalize', 'center', 'count', 'd',
                  ..., 'urlencode', 'urlize', 'wordcount', 'wordwrap', 'xmlattr'],
      'tests': ['!=', '<', '<=', '==', '>', '>=', 'callable', 'defined',
index 25dcb0b090ec59ebaf6c2515c95617fc135b0ac2..84e49f8456701c9500565ac72b69d33d09c19e70 100644 (file)
@@ -1,6 +1,6 @@
 from __future__ import print_function
 
-from jinja2 import Environment
+from jinja import Environment
 
 env = Environment(
     line_statement_prefix="#", variable_start_string="${", variable_end_string="}"
index d3c1a60a7ae82a5e928408c314e28cc7504fd618..9fa110c1cdfbc6ca24a217b05199c0b13cadfc65 100644 (file)
@@ -1,7 +1,7 @@
 from __future__ import print_function
 
-from jinja2 import Environment
-from jinja2.loaders import FileSystemLoader
+from jinja import Environment
+from jinja.loaders import FileSystemLoader
 
 env = Environment(loader=FileSystemLoader("templates"))
 tmpl = env.get_template("broken.html")
index 4a881bf8a87c1a0d826aefc3793612a05c294bc6..3f574e6cfaa238624494b691b3452f039c7b56f2 100644 (file)
@@ -1,7 +1,7 @@
 from __future__ import print_function
 
-from jinja2 import Environment
-from jinja2.loaders import DictLoader
+from jinja import Environment
+from jinja.loaders import DictLoader
 
 env = Environment(
     loader=DictLoader(
index 80b9d1f052b335629a850fc072f323eeaebcb845..2096b2297324065f881d5337d3c973c1d4c0f977 100644 (file)
@@ -1,7 +1,7 @@
 from __future__ import print_function
 
-from jinja2 import Environment
-from jinja2.loaders import DictLoader
+from jinja import Environment
+from jinja.loaders import DictLoader
 
 env = Environment(
     loader=DictLoader(
index 673b67ed76aea84d1b49a4f1a3b0a41ccffec9b3..6cb18efaee2d44c1b2da829955846f33ce7ce6a8 100644 (file)
@@ -1,6 +1,6 @@
 from __future__ import print_function
 
-from jinja2 import Environment
+from jinja import Environment
 
 env = Environment(
     line_statement_prefix="%", variable_start_string="${", variable_end_string="}"
index 39be08d61c2b8eb8cedb4ca109f97cd778d0b374..4a9ffb1fdc1f334382989937a711fd3fdffd8a50 100644 (file)
@@ -1,6 +1,6 @@
 from __future__ import print_function
 
-from jinja2 import Environment
+from jinja import Environment
 
 tmpl = Environment().from_string(
     """\
index 71547f4649cad60083814a4a1718cdf0e448928e..66a5f9cfcd35d133c7ed935fd0d5ff53ef61fc09 100644 (file)
@@ -1,8 +1,8 @@
 from __future__ import print_function
 
-from jinja2 import Environment
+from jinja import Environment
 
-env = Environment(extensions=["jinja2.ext.i18n"])
+env = Environment(extensions=["jinja.ext.i18n"])
 env.globals["gettext"] = {"Hello %(user)s!": "Hallo %(user)s!"}.__getitem__
 env.globals["ngettext"] = lambda s, p, n: {
     "%(count)s user": "%(count)d Benutzer",
index 5813199813c8af957167a7b12baf275b5f87b9b9..b1753f4c012aa99ce9d0319b1fa0d598efd612b0 100755 (executable)
@@ -58,12 +58,10 @@ def build_pattern(ranges):
 
 
 def main():
-    """Build the regex pattern and write it to
-    ``jinja2/_identifier.py``.
-    """
+    """Build the regex pattern and write it to ``_identifier.py``."""
     pattern = build_pattern(collapse_ranges(get_characters()))
     filename = os.path.abspath(
-        os.path.join(os.path.dirname(__file__), "..", "src", "jinja2", "_identifier.py")
+        os.path.join(os.path.dirname(__file__), "..", "src", "jinja", "_identifier.py")
     )
 
     with open(filename, "w", encoding="utf8") as f:
index efa15ca9d30df7cdad5ca02f7c601b4d7e6ac90d..3769e6b23132144984b942fc72af288e957ce862 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -8,19 +8,19 @@ universal = true
 testpaths = tests
 filterwarnings =
     error
-    ignore:the sets module:DeprecationWarning:jinja2.sandbox
+    ignore:the sets module:DeprecationWarning:jinja.sandbox
 
 [coverage:run]
 branch = True
 source =
-    jinja2
+    jinja
     tests
 
 [coverage:paths]
 source =
-    src/jinja2
-    .tox/*/lib/python*/site-packages/jinja2
-    .tox/*/site-packages/jinja2
+    src/jinja
+    .tox/*/lib/python*/site-packages/jinja
+    .tox/*/site-packages/jinja
 
 [flake8]
 # B = bugbear
@@ -42,4 +42,4 @@ ignore =
 max-line-length = 80
 per-file-ignores =
     # __init__ module exports names
-    src/jinja2/__init__.py: F401
+    src/jinja/__init__.py: F401
index 70915ff593f93d6a09f975011a03fb65936e0b85..80e99620233175e4f1c774834235e158ad7ccf7f 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,11 +7,11 @@ from setuptools import setup
 with io.open("README.rst", "rt", encoding="utf8") as f:
     readme = f.read()
 
-with io.open("src/jinja2/__init__.py", "rt", encoding="utf8") as f:
+with io.open("src/jinja/__init__.py", "rt", encoding="utf8") as f:
     version = re.search(r'__version__ = "(.*?)"', f.read(), re.M).group(1)
 
 setup(
-    name="Jinja2",
+    name="Jinja",
     version=version,
     url="https://palletsprojects.com/p/jinja/",
     project_urls={
@@ -51,5 +51,5 @@ setup(
     python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
     install_requires=["MarkupSafe>=0.23"],
     extras_require={"i18n": ["Babel>=0.8"]},
-    entry_points={"babel.extractors": ["jinja2 = jinja2.ext:babel_extract[i18n]"]},
+    entry_points={"babel.extractors": ["jinja = jinja.ext:babel_extract[i18n]"]},
 )
index 6f897451d5d891fee2027e80626fa734a069cd52..f3feefbbf20f1212e09719e3e510cfcfdb983539 100644 (file)
@@ -23,17 +23,14 @@ from ._compat import pickle
 from ._compat import text_type
 from .utils import open_if_exists
 
-bc_version = 3
-
-# magic version used to only change with new jinja versions.  With 2.6
-# we change this to also take Python version changes into account.  The
-# reason for this is that Python tends to segfault if fed earlier bytecode
-# versions because someone thought it would be a good idea to reuse opcodes
-# or make Python incompatible with earlier versions.
+bc_version = 4
+# Magic bytes to identify Jinja bytecode cache files. Contains the
+# Python major and minor version to avoid loading incompatible bytecode
+# if a project upgrades its Python version.
 bc_magic = (
-    "j2".encode("ascii")
+    b"jinja"
     + pickle.dumps(bc_version, 2)
-    + pickle.dumps((sys.version_info[0] << 24) | sys.version_info[1])
+    + pickle.dumps((sys.version_info[0] << 24) | sys.version_info[1], 2)
 )
 
 
@@ -97,7 +94,7 @@ class Bucket(object):
 class BytecodeCache(object):
     """To implement your own bytecode cache you have to subclass this class
     and override :meth:`load_bytecode` and :meth:`dump_bytecode`.  Both of
-    these methods are passed a :class:`~jinja2.bccache.Bucket`.
+    these methods are passed a :class:`Bucket`.
 
     A very basic bytecode cache that saves the bytecode on the file system::
 
@@ -182,15 +179,20 @@ class FileSystemBytecodeCache(BytecodeCache):
     is created for the user in the system temp directory.
 
     The pattern can be used to have multiple separate caches operate on the
-    same directory.  The default pattern is ``'__jinja2_%s.cache'``.  ``%s``
+    same directory.  The default pattern is ``'__jinja_%s.cache'``.  ``%s``
     is replaced with the cache key.
 
     >>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')
 
     This bytecode cache supports clearing of the cache using the clear method.
+
+    .. versionchanged:; 2.11
+        The default cache directory was renamed to
+        ``_jinja-cache-{uid}``. The default filename pattern was renamed
+        to ``__jinja_%s.cache``.
     """
 
-    def __init__(self, directory=None, pattern="__jinja2_%s.cache"):
+    def __init__(self, directory=None, pattern="__jinja_%s.cache"):
         if directory is None:
             directory = self._get_default_cache_dir()
         self.directory = directory
@@ -212,7 +214,7 @@ class FileSystemBytecodeCache(BytecodeCache):
         if not hasattr(os, "getuid"):
             _unsafe_dir()
 
-        dirname = "_jinja2-cache-%d" % os.getuid()
+        dirname = "_jinja-cache-%d" % os.getuid()
         actual_dir = os.path.join(tmpdir, dirname)
 
         try:
@@ -315,15 +317,18 @@ class MemcachedBytecodeCache(BytecodeCache):
     This bytecode cache does not support clearing of used items in the cache.
     The clear method is a no-operation function.
 
-    .. versionadded:: 2.7
-       Added support for ignoring memcache errors through the
-       `ignore_memcache_errors` parameter.
+    .. versionchanged:: 2.11
+        The default prefix was renamed to ``jinja/bytecode/``.
+
+    .. versionchanged:: 2.7
+        Added support for ignoring memcache errors through the
+        ``ignore_memcache_errors`` parameter.
     """
 
     def __init__(
         self,
         client,
-        prefix="jinja2/bytecode/",
+        prefix="jinja/bytecode/",
         timeout=None,
         ignore_memcache_errors=True,
     ):
index 32dac88cbca1874abfeabbd29cb8857be3955a19..88b4988bc52d3b5714a1fc4fea3966b48f23af54 100644 (file)
@@ -715,11 +715,11 @@ class CodeGenerator(NodeVisitor):
         from .runtime import __all__ as exported
 
         self.writeline("from __future__ import %s" % ", ".join(code_features))
-        self.writeline("from jinja2.runtime import " + ", ".join(exported))
+        self.writeline("from jinja.runtime import " + ", ".join(exported))
 
         if self.environment.is_async:
             self.writeline(
-                "from jinja2.asyncsupport import auto_await, "
+                "from jinja.asyncsupport import auto_await, "
                 "auto_aiter, AsyncLoopContext"
             )
 
index 08c5e6a08004808adde8c9b291a58873bf1d2f6b..16f5958e435f11c73e12ec21c4e7652a8a8ad794 100644 (file)
@@ -218,7 +218,7 @@ class Environment(object):
         `autoescape`
             If set to ``True`` the XML/HTML autoescaping feature is enabled by
             default.  For more details about autoescaping see
-            :class:`~jinja2.utils.Markup`.  As of Jinja 2.4 this can also
+            :class:`~markupsafe.Markup`. This can also
             be a callable that is passed the template name and has to
             return ``True`` or ``False`` depending on autoescape should be
             enabled by default.
@@ -262,7 +262,7 @@ class Environment(object):
 
     #: if this environment is sandboxed.  Modifying this variable won't make
     #: the environment sandboxed though.  For a real sandboxed environment
-    #: have a look at jinja2.sandbox.  This flag alone controls the code
+    #: have a look at jinja.sandbox.  This flag alone controls the code
     #: generation by the compiler.
     sandboxed = False
 
@@ -277,11 +277,11 @@ class Environment(object):
     shared = False
 
     #: the class that is used for code generation.  See
-    #: :class:`~jinja2.compiler.CodeGenerator` for more information.
+    #: :class:`~jinja.compiler.CodeGenerator` for more information.
     code_generator_class = CodeGenerator
 
     #: the context class thatis used for templates.  See
-    #: :class:`~jinja2.runtime.Context` for more information.
+    #: :class:`~jinja.runtime.Context` for more information.
     context_class = Context
 
     def __init__(
@@ -566,7 +566,7 @@ class Environment(object):
 
     def _tokenize(self, source, name, filename=None, state=None):
         """Called by the parser to do the preprocessing and filtering
-        for all the extensions.  Returns a :class:`~jinja2.lexer.TokenStream`.
+        for all the extensions.  Returns a :class:`~jinja.lexer.TokenStream`.
         """
         source = self.preprocess(source, name, filename)
         stream = self.lexer.tokenize(source, name, filename, state)
@@ -1254,7 +1254,7 @@ class TemplateModule(object):
 
 
 class TemplateExpression(object):
-    """The :meth:`jinja2.Environment.compile_expression` method returns an
+    """The :meth:`jinja.Environment.compile_expression` method returns an
     instance of this object.  It encapsulates the expression-like access
     to the template with an expression it wraps.
     """
index 01aab74a7de7c1d958c8fe057de10d33e1ea8d0c..0d0b4fe164486455a58fe542f2ce26451c3dec1a 100644 (file)
@@ -93,10 +93,10 @@ class Extension(with_metaclass(ExtensionRegistry, object)):
         return source
 
     def filter_stream(self, stream):
-        """It's passed a :class:`~jinja2.lexer.TokenStream` that can be used
+        """It's passed a :class:`~jinja.lexer.TokenStream` that can be used
         to filter tokens returned.  This method has to return an iterable of
-        :class:`~jinja2.lexer.Token`\\s, but it doesn't have to return a
-        :class:`~jinja2.lexer.TokenStream`.
+        :class:`~jinja.lexer.Token`\\s, but it doesn't have to return a
+        :class:`~jinja.lexer.TokenStream`.
         """
         return stream
 
@@ -122,7 +122,7 @@ class Extension(with_metaclass(ExtensionRegistry, object)):
         self, name, args=None, kwargs=None, dyn_args=None, dyn_kwargs=None, lineno=None
     ):
         """Call a method of the extension.  This is a shortcut for
-        :meth:`attr` + :class:`jinja2.nodes.Call`.
+        :meth:`attr` + :class:`jinja.nodes.Call`.
         """
         if args is None:
             args = []
@@ -476,9 +476,9 @@ class DebugExtension(Extension):
 
     .. code-block:: text
 
-        {'context': {'cycler': <class 'jinja2.utils.Cycler'>,
+        {'context': {'cycler': <class 'jinja.utils.Cycler'>,
                      ...,
-                     'namespace': <class 'jinja2.utils.Namespace'>},
+                     'namespace': <class 'jinja.utils.Namespace'>},
          'filters': ['abs', 'attr', 'batch', 'capitalize', 'center', 'count', 'd',
                      ..., 'urlencode', 'urlize', 'wordcount', 'wordwrap', 'xmlattr'],
          'tests': ['!=', '<', '<=', '==', '>', '>=', 'callable', 'defined',
@@ -523,7 +523,7 @@ def extract_from_ast(node, gettext_functions=GETTEXT_FUNCTIONS, babel_style=True
 
     This example explains the behavior:
 
-    >>> from jinja2 import Environment
+    >>> from jinja import Environment
     >>> env = Environment()
     >>> node = env.parse('{{ (_("foo"), _(), ngettext("foo", "bar", 42)) }}')
     >>> list(extract_from_ast(node))
index 1af7ac88a7c9aeea80b979982818addc5444612f..d090266f05edacce7a9629d382d91435b175a4d4 100644 (file)
@@ -438,10 +438,10 @@ def do_default(value, default_value=u"", boolean=False):
         {{ ''|default('the string was empty', true) }}
 
     .. versionchanged:: 2.11
-       It's now possible to configure the :class:`~jinja2.Environment` with
-       :class:`~jinja2.ChainableUndefined` to make the `default` filter work
+       It's now possible to configure the :class:`~jinja.Environment` with
+       :class:`~jinja.ChainableUndefined` to make the `default` filter work
        on nested elements and attributes that may contain undefined values
-       in the chain without getting an :exc:`~jinja2.UndefinedError`.
+       in the chain without getting an :exc:`~jinja.UndefinedError`.
     """
     if isinstance(value, Undefined) or (boolean and not value):
         return default_value
index a2b44e926b06625353f4b1a990ceb3151a32512b..e6621f1863164868b3967f1e2723e1984531c625 100644 (file)
@@ -397,7 +397,7 @@ class TokenStream(object):
 
     def expect(self, expr):
         """Expect a given token type and return it.  This accepts the same
-        argument as :meth:`jinja2.lexer.Token.test`.
+        argument as :meth:`jinja.lexer.Token.test`.
         """
         if not self.current.test(expr):
             expr = describe_token_expr(expr)
index ce5537a03c0eb8863b4e8ab7e705a0b1041bb360..cc1b0aa4315c4b2bb8d9528d33418a7188e48223 100644 (file)
@@ -46,7 +46,7 @@ class BaseLoader(object):
     A very basic example for a loader that looks up templates on the file
     system could look like this::
 
-        from jinja2 import BaseLoader, TemplateNotFound
+        from jinja import BaseLoader, TemplateNotFound
         from os.path import join, exists, getmtime
 
         class MyLoader(BaseLoader):
@@ -523,7 +523,7 @@ class ModuleLoader(BaseLoader):
     has_source_access = False
 
     def __init__(self, path):
-        package_name = "_jinja2_module_templates_%x" % id(self)
+        package_name = "_jinja_module_templates_%x" % id(self)
 
         # create a fake module that looks for the templates in the
         # path given.
index 3795aace59da12815544dfcd5bb9973e196f7a43..f37141d90a60984502f9a83c5908ea5cc0c2a6b5 100644 (file)
@@ -32,7 +32,7 @@ def find_undeclared_variables(ast):
     variables will be used depending on the path the execution takes at
     runtime, all variables are returned.
 
-    >>> from jinja2 import Environment, meta
+    >>> from jinja import Environment, meta
     >>> env = Environment()
     >>> ast = env.parse('{% set foo = 42 %}{{ bar + foo }}')
     >>> meta.find_undeclared_variables(ast) == set(['bar'])
@@ -56,7 +56,7 @@ def find_referenced_templates(ast):
     imports.  If dynamic inheritance or inclusion is used, `None` will be
     yielded.
 
-    >>> from jinja2 import Environment, meta
+    >>> from jinja import Environment, meta
     >>> env = Environment()
     >>> ast = env.parse('{% extends "layout.html" %}{% include helper %}')
     >>> list(meta.find_referenced_templates(ast))
index f0e9e03239933e076704f532498880877b7ee6b2..e0128d38ca8c875caa494c69d95ceb94182ed3e5 100644 (file)
@@ -937,7 +937,7 @@ class ExtensionAttribute(Expr):
     The identifier is the identifier of the :class:`Extension`.
 
     This node is usually constructed by calling the
-    :meth:`~jinja2.ext.Extension.attr` method on an extension.
+    :meth:`~jinja.ext.Extension.attr` method on an extension.
     """
 
     fields = ("identifier", "name")
@@ -956,7 +956,7 @@ class ImportedName(Expr):
 class InternalName(Expr):
     """An internal name in the compiler.  You cannot create these nodes
     yourself but the parser provides a
-    :meth:`~jinja2.parser.Parser.free_identifier` method that creates
+    :meth:`~jinja.parser.Parser.free_identifier` method that creates
     a new identifier for you.  This identifier is not available from the
     template and is not threated specially by the compiler.
     """
@@ -1002,7 +1002,7 @@ class MarkSafeIfAutoescape(Expr):
 class ContextReference(Expr):
     """Returns the current template context.  It can be used like a
     :class:`Name` node, with a ``'load'`` ctx and will return the
-    current :class:`~jinja2.runtime.Context` object.
+    current :class:`~jinja.runtime.Context` object.
 
     Here an example that assigns the current template name to a
     variable named `foo`::
@@ -1011,7 +1011,7 @@ class ContextReference(Expr):
                Getattr(ContextReference(), 'name'))
 
     This is basically equivalent to using the
-    :func:`~jinja2.contextfunction` decorator when using the
+    :func:`~jinja.contextfunction` decorator when using the
     high-level API, which causes a reference to the context to be passed
     as the first argument to a function.
     """
@@ -1072,7 +1072,7 @@ class EvalContextModifier(Stmt):
 class ScopedEvalContextModifier(EvalContextModifier):
     """Modifies the eval context and reverts it later.  Works exactly like
     :class:`EvalContextModifier` but will only modify the
-    :class:`~jinja2.nodes.EvalContext` for nodes in the :attr:`body`.
+    :class:`~jinja.nodes.EvalContext` for nodes in the :attr:`body`.
     """
 
     fields = ("body",)
index d5881066f7461b01291067f19c356d39dc75d38b..7bf3a29475aa7dbc3004b4eb890478604116a7eb 100644 (file)
@@ -123,7 +123,7 @@ class Parser(object):
         return False
 
     def free_identifier(self, lineno=None):
-        """Return a new free identifier as :class:`~jinja2.nodes.InternalName`."""
+        """Return a new free identifier as :class:`~jinja.nodes.InternalName`."""
         self._last_identifier += 1
         rv = object.__new__(nodes.InternalName)
         nodes.Node.__init__(rv, "fi%d" % self._last_identifier, lineno=lineno)
@@ -607,7 +607,7 @@ class Parser(object):
         explicit_parentheses=False,
     ):
         """Works like `parse_expression` but if multiple expressions are
-        delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created.
+        delimited by a comma a :class:`~jinja.nodes.Tuple` node is created.
         This method could also return a regular expression instead of a tuple
         if no commas where found.
 
index d356b074672a085a8946c797729b973727a01fb5..f6d58a61ab0880a5ec80084e7c3e416b91026070 100644 (file)
@@ -701,7 +701,7 @@ class Undefined(object):
     >>> foo + 42
     Traceback (most recent call last):
       ...
-    jinja2.exceptions.UndefinedError: 'foo' is undefined
+    jinja.exceptions.UndefinedError: 'foo' is undefined
     """
 
     __slots__ = (
@@ -926,7 +926,7 @@ class ChainableUndefined(Undefined):
     >>> foo.bar['baz'] + 42
     Traceback (most recent call last):
       ...
-    jinja2.exceptions.UndefinedError: 'foo' is undefined
+    jinja.exceptions.UndefinedError: 'foo' is undefined
 
     .. versionadded:: 2.11.0
     """
@@ -954,7 +954,7 @@ class DebugUndefined(Undefined):
     >>> foo + 42
     Traceback (most recent call last):
       ...
-    jinja2.exceptions.UndefinedError: 'foo' is undefined
+    jinja.exceptions.UndefinedError: 'foo' is undefined
     """
 
     __slots__ = ()
@@ -980,15 +980,15 @@ class StrictUndefined(Undefined):
     >>> str(foo)
     Traceback (most recent call last):
       ...
-    jinja2.exceptions.UndefinedError: 'foo' is undefined
+    jinja.exceptions.UndefinedError: 'foo' is undefined
     >>> not foo
     Traceback (most recent call last):
       ...
-    jinja2.exceptions.UndefinedError: 'foo' is undefined
+    jinja.exceptions.UndefinedError: 'foo' is undefined
     >>> foo + 42
     Traceback (most recent call last):
       ...
-    jinja2.exceptions.UndefinedError: 'foo' is undefined
+    jinja.exceptions.UndefinedError: 'foo' is undefined
     """
 
     __slots__ = ()
index af4a96e684d8f87358211155c876c034cffeca82..28f4c8ddca916923bc165922cdff1de020829de3 100644 (file)
@@ -197,7 +197,7 @@ def is_internal_attribute(obj, attr):
     python objects.  This is useful if the environment method
     :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
 
-    >>> from jinja2.sandbox import is_internal_attribute
+    >>> from jinja.sandbox import is_internal_attribute
     >>> is_internal_attribute(str, "mro")
     True
     >>> is_internal_attribute(str, "upper")
index e3285e8edb45daf70b7612d8ad256f29ff09f456..b88e24bdc5625d6418f212dfd41dc5e3c777f02d 100644 (file)
@@ -543,7 +543,7 @@ def select_autoescape(
     If you want to enable it for all templates created from strings or
     for all templates with `.html` and `.xml` extensions::
 
-        from jinja2 import Environment, select_autoescape
+        from jinja import Environment, select_autoescape
         env = Environment(autoescape=select_autoescape(
             enabled_extensions=('html', 'xml'),
             default_for_string=True,
@@ -552,7 +552,7 @@ def select_autoescape(
     Example configuration to turn it on at all times except if the template
     ends with `.txt`::
 
-        from jinja2 import Environment, select_autoescape
+        from jinja import Environment, select_autoescape
         env = Environment(autoescape=select_autoescape(
             disabled_extensions=('txt',),
             default_for_string=True,
@@ -719,7 +719,7 @@ def soft_unicode(s):
     from markupsafe import soft_unicode
 
     warnings.warn(
-        "'jinja2.utils.soft_unicode' will be removed in version 3.0."
+        "'jinja.utils.soft_unicode' will be removed in version 3.0."
         " Use 'markupsafe.soft_unicode' instead.",
         DeprecationWarning,
         stacklevel=2,
index bb26409a5ca4195dfd16b9bc52a589b397057888..633296e5ed2bd646a1364b79e86ab540bbd7ae42 100644 (file)
@@ -3,9 +3,9 @@ import os
 
 import pytest
 
-from jinja2 import Environment
-from jinja2 import loaders
-from jinja2.utils import have_async_gen
+from jinja import Environment
+from jinja import loaders
+from jinja.utils import have_async_gen
 
 
 def pytest_ignore_collect(path):
index 0c262dc4b85bb6244c08370fb41465e44ff03bee..2d621b7f014367f5d24e946802de8d199b1d44dd 100644 (file)
@@ -5,31 +5,31 @@ import tempfile
 
 import pytest
 
-from jinja2 import ChainableUndefined
-from jinja2 import DebugUndefined
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2 import is_undefined
-from jinja2 import make_logging_undefined
-from jinja2 import meta
-from jinja2 import StrictUndefined
-from jinja2 import Template
-from jinja2 import TemplatesNotFound
-from jinja2 import Undefined
-from jinja2 import UndefinedError
-from jinja2.compiler import CodeGenerator
-from jinja2.runtime import Context
-from jinja2.utils import contextfunction
-from jinja2.utils import Cycler
-from jinja2.utils import environmentfunction
-from jinja2.utils import evalcontextfunction
+from jinja import ChainableUndefined
+from jinja import DebugUndefined
+from jinja import DictLoader
+from jinja import Environment
+from jinja import is_undefined
+from jinja import make_logging_undefined
+from jinja import meta
+from jinja import StrictUndefined
+from jinja import Template
+from jinja import TemplatesNotFound
+from jinja import Undefined
+from jinja import UndefinedError
+from jinja.compiler import CodeGenerator
+from jinja.runtime import Context
+from jinja.utils import contextfunction
+from jinja.utils import Cycler
+from jinja.utils import environmentfunction
+from jinja.utils import evalcontextfunction
 
 
 @pytest.mark.api
 @pytest.mark.extended
 class TestExtendedAPI(object):
     def test_item_and_attribute(self, env):
-        from jinja2.sandbox import SandboxedEnvironment
+        from jinja.sandbox import SandboxedEnvironment
 
         for env in Environment(), SandboxedEnvironment():
             # the |list is necessary for python3
@@ -154,7 +154,7 @@ class TestExtendedAPI(object):
         assert t.render(foo="<foo>") == "<foo>"
 
     def test_sandbox_max_range(self, env):
-        from jinja2.sandbox import SandboxedEnvironment, MAX_RANGE
+        from jinja.sandbox import SandboxedEnvironment, MAX_RANGE
 
         env = SandboxedEnvironment()
         t = env.from_string("{% for item in range(total) %}{{ item }}{% endfor %}")
index f7e27922ea84773c1f2d13a615e00b2f7442fe6d..de1c0f2b49e8500635b2fb020f268273f9334b04 100644 (file)
@@ -2,13 +2,13 @@ import asyncio
 
 import pytest
 
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2 import Template
-from jinja2.asyncsupport import auto_aiter
-from jinja2.exceptions import TemplateNotFound
-from jinja2.exceptions import TemplatesNotFound
-from jinja2.exceptions import UndefinedError
+from jinja import DictLoader
+from jinja import Environment
+from jinja import Template
+from jinja.asyncsupport import auto_aiter
+from jinja.exceptions import TemplateNotFound
+from jinja.exceptions import TemplatesNotFound
+from jinja.exceptions import UndefinedError
 
 
 def run(coro):
index 7c737c835e0846c0a57d7abff4a93a5aba49af4a..98090ab877dbb202402d7739a75caa34654b3a14 100644 (file)
@@ -2,8 +2,8 @@ from collections import namedtuple
 
 import pytest
 
-from jinja2 import Environment
-from jinja2.utils import Markup
+from jinja import Environment
+from jinja.utils import Markup
 
 
 async def make_aiter(iter):
index 6863690a16652f2f821c1b9f5a23d08ba4214603..6a6173a0bd7d03890a8154f6933432bd54f4076f 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 import pytest
 
-from jinja2 import Environment
-from jinja2.bccache import Bucket
-from jinja2.bccache import FileSystemBytecodeCache
-from jinja2.bccache import MemcachedBytecodeCache
-from jinja2.exceptions import TemplateNotFound
+from jinja import Environment
+from jinja.bccache import Bucket
+from jinja.bccache import FileSystemBytecodeCache
+from jinja.bccache import MemcachedBytecodeCache
+from jinja.exceptions import TemplateNotFound
 
 
 @pytest.fixture
@@ -53,7 +53,7 @@ class TestMemcachedBytecodeCache(object):
         b = Bucket(None, "key", "")
         b.code = "code"
         m.dump_bytecode(b)
-        assert memcached.key == "jinja2/bytecode/key"
+        assert memcached.key == "jinja/bytecode/key"
 
         b = Bucket(None, "key", "")
         m.load_bytecode(b)
index 4132c4f5ea25cac64e9646afa9ae1c008939a809..3f166766065afdaee24d51dc23b234803d537d10 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 import pytest
 
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2 import TemplateRuntimeError
-from jinja2 import TemplateSyntaxError
-from jinja2 import UndefinedError
+from jinja import DictLoader
+from jinja import Environment
+from jinja import TemplateRuntimeError
+from jinja import TemplateSyntaxError
+from jinja import UndefinedError
 
 
 @pytest.fixture
index 5ca92d92d098d86e78fa54e3a4720692ac171684..a0e779bd92ff0ba9cc528a4bbc340cdedd2be394 100644 (file)
@@ -5,10 +5,10 @@ from traceback import format_exception
 
 import pytest
 
-from jinja2 import ChoiceLoader
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2 import TemplateSyntaxError
+from jinja import ChoiceLoader
+from jinja import DictLoader
+from jinja import Environment
+from jinja import TemplateSyntaxError
 
 
 @pytest.fixture
@@ -55,7 +55,7 @@ ZeroDivisionError: (int(eger)? )?division (or modulo )?by zero
             """(?sm)
   File ".*?syntaxerror.html", line 4, in (template|<module>)
     \\{% endif %\\}.*?
-(jinja2\\.exceptions\\.)?TemplateSyntaxError: Encountered unknown tag 'endif'. Jinja \
+(jinja\\.exceptions\\.)?TemplateSyntaxError: Encountered unknown tag 'endif'. Jinja \
 was looking for the following tags: 'endfor' or 'else'. The innermost block that needs \
 to be closed is 'for'.
     """,
@@ -70,7 +70,7 @@ to be closed is 'for'.
             r"""
   File ".*debug.pyc?", line \d+, in test
     raise TemplateSyntaxError\("wtf", 42\)
-(jinja2\.exceptions\.)?TemplateSyntaxError: wtf
+(jinja\.exceptions\.)?TemplateSyntaxError: wtf
   line 42""",
         )
 
@@ -97,8 +97,8 @@ to be closed is 'for'.
         assert exc_info.value.source is not None
 
     def test_local_extraction(self):
-        from jinja2.debug import get_template_locals
-        from jinja2.runtime import missing
+        from jinja.debug import get_template_locals
+        from jinja.runtime import missing
 
         locals = get_template_locals(
             {
index 67d2cdb5259e01f15540bf99e89dd3e87e216ef6..ebb83e6fcdbec327719a172e4aafc3bbbc807441 100644 (file)
@@ -3,17 +3,17 @@ import re
 
 import pytest
 
-from jinja2 import contextfunction
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2 import nodes
-from jinja2._compat import BytesIO
-from jinja2._compat import itervalues
-from jinja2._compat import text_type
-from jinja2.exceptions import TemplateAssertionError
-from jinja2.ext import Extension
-from jinja2.lexer import count_newlines
-from jinja2.lexer import Token
+from jinja import contextfunction
+from jinja import DictLoader
+from jinja import Environment
+from jinja import nodes
+from jinja._compat import BytesIO
+from jinja._compat import itervalues
+from jinja._compat import text_type
+from jinja.exceptions import TemplateAssertionError
+from jinja.ext import Extension
+from jinja.lexer import count_newlines
+from jinja.lexer import Token
 
 importable_object = 23
 
@@ -80,18 +80,16 @@ def ngettext(context, s, p, n):
     return languages.get(language, {}).get(s, s)
 
 
-i18n_env = Environment(
-    loader=DictLoader(i18n_templates), extensions=["jinja2.ext.i18n"]
-)
+i18n_env = Environment(loader=DictLoader(i18n_templates), extensions=["jinja.ext.i18n"])
 i18n_env.globals.update({"_": gettext, "gettext": gettext, "ngettext": ngettext})
-i18n_env_trimmed = Environment(extensions=["jinja2.ext.i18n"])
+i18n_env_trimmed = Environment(extensions=["jinja.ext.i18n"])
 i18n_env_trimmed.policies["ext.i18n.trimmed"] = True
 i18n_env_trimmed.globals.update(
     {"_": gettext, "gettext": gettext, "ngettext": ngettext}
 )
 
 newstyle_i18n_env = Environment(
-    loader=DictLoader(newstyle_i18n_templates), extensions=["jinja2.ext.i18n"]
+    loader=DictLoader(newstyle_i18n_templates), extensions=["jinja.ext.i18n"]
 )
 newstyle_i18n_env.install_gettext_callables(gettext, ngettext, newstyle=True)
 
@@ -171,12 +169,12 @@ class StreamFilterExtension(Extension):
 class TestExtensions(object):
     def test_extend_late(self):
         env = Environment()
-        env.add_extension("jinja2.ext.autoescape")
+        env.add_extension("jinja.ext.autoescape")
         t = env.from_string('{% autoescape true %}{{ "<test>" }}{% endautoescape %}')
         assert t.render() == "&lt;test&gt;"
 
     def test_loop_controls(self):
-        env = Environment(extensions=["jinja2.ext.loopcontrols"])
+        env = Environment(extensions=["jinja.ext.loopcontrols"])
 
         tmpl = env.from_string(
             """
@@ -197,7 +195,7 @@ class TestExtensions(object):
         assert tmpl.render() == "12"
 
     def test_do(self):
-        env = Environment(extensions=["jinja2.ext.do"])
+        env = Environment(extensions=["jinja.ext.do"])
         tmpl = env.from_string(
             """
             {%- set items = [] %}
@@ -259,7 +257,7 @@ class TestExtensions(object):
         assert ext[1].__class__ is T2
 
     def test_debug(self):
-        env = Environment(extensions=["jinja2.ext.debug"])
+        env = Environment(extensions=["jinja.ext.debug"])
         t = env.from_string("Hello\n{% debug %}\nGoodbye")
         out = t.render()
 
@@ -339,7 +337,7 @@ class TestInternationalization(object):
         assert tmpl.render() == "  hello\n  world  "
 
     def test_extract(self):
-        from jinja2.ext import babel_extract
+        from jinja.ext import babel_extract
 
         source = BytesIO(
             """
@@ -357,7 +355,7 @@ class TestInternationalization(object):
         ]
 
     def test_extract_trimmed(self):
-        from jinja2.ext import babel_extract
+        from jinja.ext import babel_extract
 
         source = BytesIO(
             """
@@ -376,7 +374,7 @@ class TestInternationalization(object):
         ]
 
     def test_extract_trimmed_option(self):
-        from jinja2.ext import babel_extract
+        from jinja.ext import babel_extract
 
         source = BytesIO(
             """
@@ -396,7 +394,7 @@ class TestInternationalization(object):
         ]
 
     def test_comment_extract(self):
-        from jinja2.ext import babel_extract
+        from jinja.ext import babel_extract
 
         source = BytesIO(
             """
@@ -485,7 +483,7 @@ class TestNewstyleInternationalization(object):
         assert tmpl.render(LANGUAGE="de", apples=5) == u"5 Äpfel"
 
     def test_autoescape_support(self):
-        env = Environment(extensions=["jinja2.ext.autoescape", "jinja2.ext.i18n"])
+        env = Environment(extensions=["jinja.ext.autoescape", "jinja.ext.i18n"])
         env.install_gettext_callables(
             lambda x: u"<strong>Wert: %(name)s</strong>",
             lambda s, p, n: s,
@@ -499,7 +497,7 @@ class TestNewstyleInternationalization(object):
         assert t.render(ae=False) == "<strong>Wert: <test></strong>"
 
     def test_autoescape_macros(self):
-        env = Environment(autoescape=False, extensions=["jinja2.ext.autoescape"])
+        env = Environment(autoescape=False, extensions=["jinja.ext.autoescape"])
         template = (
             "{% macro m() %}<html>{% endmacro %}"
             "{% autoescape true %}{{ m() }}{% endautoescape %}"
@@ -547,7 +545,7 @@ class TestNewstyleInternationalization(object):
 @pytest.mark.ext
 class TestAutoEscape(object):
     def test_scoped_setting(self):
-        env = Environment(extensions=["jinja2.ext.autoescape"], autoescape=True)
+        env = Environment(extensions=["jinja.ext.autoescape"], autoescape=True)
         tmpl = env.from_string(
             """
             {{ "<HelloWorld>" }}
@@ -563,7 +561,7 @@ class TestAutoEscape(object):
             u"&lt;HelloWorld&gt;",
         ]
 
-        env = Environment(extensions=["jinja2.ext.autoescape"], autoescape=False)
+        env = Environment(extensions=["jinja.ext.autoescape"], autoescape=False)
         tmpl = env.from_string(
             """
             {{ "<HelloWorld>" }}
@@ -580,7 +578,7 @@ class TestAutoEscape(object):
         ]
 
     def test_nonvolatile(self):
-        env = Environment(extensions=["jinja2.ext.autoescape"], autoescape=True)
+        env = Environment(extensions=["jinja.ext.autoescape"], autoescape=True)
         tmpl = env.from_string('{{ {"foo": "<test>"}|xmlattr|escape }}')
         assert tmpl.render() == ' foo="&lt;test&gt;"'
         tmpl = env.from_string(
@@ -590,7 +588,7 @@ class TestAutoEscape(object):
         assert tmpl.render() == " foo=&#34;&amp;lt;test&amp;gt;&#34;"
 
     def test_volatile(self):
-        env = Environment(extensions=["jinja2.ext.autoescape"], autoescape=True)
+        env = Environment(extensions=["jinja.ext.autoescape"], autoescape=True)
         tmpl = env.from_string(
             '{% autoescape foo %}{{ {"foo": "<test>"}'
             "|xmlattr|escape }}{% endautoescape %}"
@@ -599,7 +597,7 @@ class TestAutoEscape(object):
         assert tmpl.render(foo=True) == ' foo="&lt;test&gt;"'
 
     def test_scoping(self):
-        env = Environment(extensions=["jinja2.ext.autoescape"])
+        env = Environment(extensions=["jinja.ext.autoescape"])
         tmpl = env.from_string(
             '{% autoescape true %}{% set x = "<x>" %}{{ x }}'
             '{% endautoescape %}{{ x }}{{ "<y>" }}'
@@ -607,7 +605,7 @@ class TestAutoEscape(object):
         assert tmpl.render(x=1) == "&lt;x&gt;1<y>"
 
     def test_volatile_scoping(self):
-        env = Environment(extensions=["jinja2.ext.autoescape"])
+        env = Environment(extensions=["jinja.ext.autoescape"])
         tmplsource = """
         {% autoescape val %}
             {% macro foo(x) %}
@@ -623,11 +621,11 @@ class TestAutoEscape(object):
 
         # looking at the source we should see <testing> there in raw
         # (and then escaped as well)
-        env = Environment(extensions=["jinja2.ext.autoescape"])
+        env = Environment(extensions=["jinja.ext.autoescape"])
         pysource = env.compile(tmplsource, raw=True)
         assert "<testing>\\n" in pysource
 
-        env = Environment(extensions=["jinja2.ext.autoescape"], autoescape=True)
+        env = Environment(extensions=["jinja.ext.autoescape"], autoescape=True)
         pysource = env.compile(tmplsource, raw=True)
         assert "&lt;testing&gt;\\n" in pysource
 
index 34b6f200deab22533911fb1ec800ff8770254792..5966a5dde90eb1922b461c1d03c46b20cc92caf0 100644 (file)
@@ -2,10 +2,10 @@ import sys
 
 import pytest
 
-from jinja2 import contextfilter
-from jinja2 import Environment
-from jinja2 import Template
-from jinja2._compat import text_type
+from jinja import contextfilter
+from jinja import Environment
+from jinja import Template
+from jinja._compat import text_type
 
 
 @pytest.mark.skipif(sys.version_info < (3, 5), reason="Requires 3.5 or later")
index 109f4441f8e05b3bc6ddd32873b81abea868a460..e4b69ad7bf9521972abcea8f9237b30e8d006114 100644 (file)
@@ -4,10 +4,10 @@ from collections import namedtuple
 
 import pytest
 
-from jinja2 import Environment
-from jinja2 import Markup
-from jinja2._compat import implements_to_string
-from jinja2._compat import text_type
+from jinja import Environment
+from jinja import Markup
+from jinja._compat import implements_to_string
+from jinja._compat import text_type
 
 
 @implements_to_string
index 4c79ee6c4718d2989821081de55e643f7deb72c4..d9943a1f47c36377ba6f062bce7b658946d7a88c 100644 (file)
@@ -1,5 +1,5 @@
-from jinja2 import nodes
-from jinja2.idtracking import symbols_for_node
+from jinja import nodes
+from jinja.idtracking import symbols_for_node
 
 
 def test_basics():
index 0dae2173f22625a42d5443638377c90bb48d5717..133b6c38780dfc8a78380c4c5ff18184f379603b 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 import pytest
 
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2.exceptions import TemplateNotFound
-from jinja2.exceptions import TemplatesNotFound
-from jinja2.exceptions import TemplateSyntaxError
+from jinja import DictLoader
+from jinja import Environment
+from jinja.exceptions import TemplateNotFound
+from jinja.exceptions import TemplatesNotFound
+from jinja.exceptions import TemplateSyntaxError
 
 
 @pytest.fixture
index 92f66e04fb9d18b4145480705649dc1b4c7306f9..9750b913787e2c80807a6783bd90e6a3c6a777c0 100644 (file)
@@ -1,9 +1,9 @@
 # -*- coding: utf-8 -*-
 import pytest
 
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2 import TemplateRuntimeError
+from jinja import DictLoader
+from jinja import Environment
+from jinja import TemplateRuntimeError
 
 LAYOUTTEMPLATE = """\
 |{% block block1 %}block 1 from layout{% endblock %}
index 9da9380581112b0a14c558bf3b15a36fb657a7c9..78d703f245d7e0bb3ab5b9fa1a8189bf3dbddc93 100644 (file)
@@ -1,19 +1,19 @@
 # -*- coding: utf-8 -*-
 import pytest
 
-from jinja2 import Environment
-from jinja2 import nodes
-from jinja2 import Template
-from jinja2 import TemplateSyntaxError
-from jinja2 import UndefinedError
-from jinja2._compat import iteritems
-from jinja2._compat import PY2
-from jinja2._compat import text_type
-from jinja2.lexer import Token
-from jinja2.lexer import TOKEN_BLOCK_BEGIN
-from jinja2.lexer import TOKEN_BLOCK_END
-from jinja2.lexer import TOKEN_EOF
-from jinja2.lexer import TokenStream
+from jinja import Environment
+from jinja import nodes
+from jinja import Template
+from jinja import TemplateSyntaxError
+from jinja import UndefinedError
+from jinja._compat import iteritems
+from jinja._compat import PY2
+from jinja._compat import text_type
+from jinja.lexer import Token
+from jinja.lexer import TOKEN_BLOCK_BEGIN
+from jinja.lexer import TOKEN_BLOCK_END
+from jinja.lexer import TOKEN_EOF
+from jinja.lexer import TokenStream
 
 
 # how does a string look like in jinja syntax?
@@ -122,7 +122,7 @@ class TestLexer(object):
         assert tmpl.render() == pformat("foo") + "|" + pformat(u"bär")
 
     def test_operators(self, env):
-        from jinja2.lexer import operators
+        from jinja.lexer import operators
 
         for test, expect in iteritems(operators):
             if test in "([{}])":
index 4aa6511ef2a57fe00d0822c77b56ec6bd6ff25ee..f65a8925a52d2b33693f3a6060a31becdaf01e59 100644 (file)
@@ -8,13 +8,13 @@ import weakref
 
 import pytest
 
-from jinja2 import Environment
-from jinja2 import loaders
-from jinja2 import PackageLoader
-from jinja2._compat import PY2
-from jinja2._compat import PYPY
-from jinja2.exceptions import TemplateNotFound
-from jinja2.loaders import split_template_path
+from jinja import Environment
+from jinja import loaders
+from jinja import PackageLoader
+from jinja._compat import PY2
+from jinja._compat import PYPY
+from jinja.exceptions import TemplateNotFound
+from jinja.loaders import split_template_path
 
 
 @pytest.mark.loaders
index 77d378d27d44ef95f1705d233a9ae1739d1b8c5e..7f26142cf65f6ef05e85a87d904ceadcaca31a84 100644 (file)
@@ -1,10 +1,10 @@
 import pytest
 
-from jinja2._compat import text_type
-from jinja2.exceptions import UndefinedError
-from jinja2.nativetypes import NativeEnvironment
-from jinja2.nativetypes import NativeTemplate
-from jinja2.runtime import Undefined
+from jinja._compat import text_type
+from jinja.exceptions import UndefinedError
+from jinja.nativetypes import NativeEnvironment
+from jinja.nativetypes import NativeTemplate
+from jinja.runtime import Undefined
 
 
 @pytest.fixture
index accc1f62a48cb2ccac7416216ba636583a4c61d6..3a3e3bb55399ca97e0f63a9ecfee0af1ecdc8a42 100644 (file)
@@ -3,14 +3,14 @@ import sys
 
 import pytest
 
-from jinja2 import DictLoader
-from jinja2 import Environment
-from jinja2 import PrefixLoader
-from jinja2 import Template
-from jinja2 import TemplateAssertionError
-from jinja2 import TemplateNotFound
-from jinja2 import TemplateSyntaxError
-from jinja2._compat import text_type
+from jinja import DictLoader
+from jinja import Environment
+from jinja import PrefixLoader
+from jinja import Template
+from jinja import TemplateAssertionError
+from jinja import TemplateNotFound
+from jinja import TemplateSyntaxError
+from jinja._compat import text_type
 
 
 @pytest.mark.regression
@@ -295,7 +295,7 @@ class TestBug(object):
         assert e.value.name == "foo/bar.html"
 
     def test_contextfunction_callable_classes(self, env):
-        from jinja2.utils import contextfunction
+        from jinja.utils import contextfunction
 
         class CallableClass(object):
             @contextfunction
@@ -369,7 +369,7 @@ class TestBug(object):
 
     def test_macro_escaping(self):
         env = Environment(
-            autoescape=lambda x: False, extensions=["jinja2.ext.autoescape"]
+            autoescape=lambda x: False, extensions=["jinja.ext.autoescape"]
         )
         template = "{% macro m() %}<html>{% endmacro %}"
         template += "{% autoescape true %}{{ m() }}{% endautoescape %}"
@@ -577,7 +577,7 @@ class TestBug(object):
         assert env.get_template("main").render() == "123"
 
     def test_grouper_repr(self):
-        from jinja2.filters import _GroupTuple
+        from jinja.filters import _GroupTuple
 
         t = _GroupTuple("foo", [1, 2])
         assert t.grouper == "foo"
@@ -586,7 +586,7 @@ class TestBug(object):
         assert str(t) == "('foo', [1, 2])"
 
     def test_custom_context(self, env):
-        from jinja2.runtime import Context
+        from jinja.runtime import Context
 
         class MyContext(Context):
             pass
@@ -599,7 +599,7 @@ class TestBug(object):
         assert env.get_template("test").render(foobar="test") == "test"
 
     def test_legacy_custom_context(self, env):
-        from jinja2.runtime import Context, missing
+        from jinja.runtime import Context, missing
 
         class MyContext(Context):
             def resolve(self, name):
@@ -620,7 +620,7 @@ class TestBug(object):
         assert tmpl.render(values=[]) == "0"
 
     def test_markup_and_chainable_undefined(self):
-        from jinja2 import Markup
-        from jinja2.runtime import ChainableUndefined
+        from jinja import Markup
+        from jinja.runtime import ChainableUndefined
 
         assert str(Markup(ChainableUndefined())) == ""
index d24f2660cf0c1c1d53115765ef939372a776f513..f03e361fbc5c55de0d8061f4ca86723528044830 100644 (file)
@@ -1,7 +1,7 @@
 import itertools
 
-from jinja2 import Template
-from jinja2.runtime import LoopContext
+from jinja import Template
+from jinja.runtime import LoopContext
 
 TEST_IDX_TEMPLATE_STR_1 = (
     "[{% for i in lst|reverse %}(len={{ loop.length }},"
index f092c96d95284775a58fab7d43913d0ca3369ae4..cd9a5bf250738ebbced211e729ea554b280405e7 100644 (file)
@@ -1,17 +1,17 @@
 # -*- coding: utf-8 -*-
 import pytest
 
-from jinja2 import Environment
-from jinja2 import escape
-from jinja2 import Markup
-from jinja2._compat import text_type
-from jinja2.exceptions import SecurityError
-from jinja2.exceptions import TemplateRuntimeError
-from jinja2.exceptions import TemplateSyntaxError
-from jinja2.nodes import EvalContext
-from jinja2.sandbox import ImmutableSandboxedEnvironment
-from jinja2.sandbox import SandboxedEnvironment
-from jinja2.sandbox import unsafe
+from jinja import Environment
+from jinja import escape
+from jinja import Markup
+from jinja._compat import text_type
+from jinja.exceptions import SecurityError
+from jinja.exceptions import TemplateRuntimeError
+from jinja.exceptions import TemplateSyntaxError
+from jinja.nodes import EvalContext
+from jinja.sandbox import ImmutableSandboxedEnvironment
+from jinja.sandbox import SandboxedEnvironment
+from jinja.sandbox import unsafe
 
 
 class PrivateStuff(object):
index 42595e8fd6cee1e6e0058a9b0c62db21bfa5abd7..ebd740a76140a9f476bfaebc8523263729d526b7 100644 (file)
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 import pytest
 
-from jinja2 import Environment
-from jinja2 import Markup
+from jinja import Environment
+from jinja import Markup
 
 
 class MyDict(dict):
index 58165efbf09bc9e53bd5c391c5ce25cd7f31146b..c5562ee398a1a3f9eee65d6a0876cdedd8a0924f 100644 (file)
@@ -7,15 +7,15 @@ from copy import copy as shallow_copy
 import pytest
 from markupsafe import Markup
 
-from jinja2._compat import range_type
-from jinja2._compat import string_types
-from jinja2.utils import consume
-from jinja2.utils import generate_lorem_ipsum
-from jinja2.utils import LRUCache
-from jinja2.utils import missing
-from jinja2.utils import object_type_repr
-from jinja2.utils import select_autoescape
-from jinja2.utils import urlize
+from jinja._compat import range_type
+from jinja._compat import string_types
+from jinja.utils import consume
+from jinja.utils import generate_lorem_ipsum
+from jinja.utils import LRUCache
+from jinja.utils import missing
+from jinja.utils import object_type_repr
+from jinja.utils import select_autoescape
+from jinja.utils import urlize
 
 
 @pytest.mark.utils