Mako Templates for Python

Related tags

Template Engine mako
Overview

Mako Templates for Python

Mako is a template library written in Python. It provides a familiar, non-XML syntax which compiles into Python modules for maximum performance. Mako's syntax and API borrows from the best ideas of many others, including Django templates, Cheetah, Myghty, and Genshi. Conceptually, Mako is an embedded Python (i.e. Python Server Page) language, which refines the familiar ideas of componentized layout and inheritance to produce one of the most straightforward and flexible models available, while also maintaining close ties to Python calling and scoping semantics.

Nutshell

<%inherit file="base.html"/>
<%
    rows = [[v for v in range(0,10)] for row in range(0,10)]
%>

 
  
    % for row in rows:
        ${makerow(row)}
    % endfor

 
<%def name="makerow(row)"> % for name in row: ${name}\ % endfor

Philosophy

Python is a great scripting language. Don't reinvent the wheel...your templates can handle it !

Documentation

See documentation for Mako at https://docs.makotemplates.org/en/latest/

License

Mako is licensed under an MIT-style license (see LICENSE). Other incorporated projects may be licensed under different licenses. All licenses allow for non-commercial and commercial use.

Comments
  • Mako wheels have computed install_requires

    Mako wheels have computed install_requires

    Migrated issue, originally created by RobertR (@rbtcollins)

    Terrible title, sorry.

    So Mako computes a value for install_requires in setup.py. This results in the wheel thats built being python version specific - concretely if you build a wheel using Python 3.2 it won't depend on MarkupSafe, but on 3.2 or 2.6/2.7 it will will.

    This shows up when wheels are reused across Python versions (one way to do this is via the pip wheel cache): https://github.com/pypa/pip/issues/3025 - if Python 3.2 is used to install mako, then when an install is done on 3.3 MarkupSafe isn't installed. Conversely if Python 3.3 is used to do the first install, then on 3.2 MarkupSafe will be installed even though its (presumably) incompatible.

    A similar issue applies to the argparse conditional: if the wheel is built on 2.6, it will drag in argparse when installed on 2.7/3.x.

    Your setup.cfg has universal=1 so it looks like you intend to build wheels suitable for multiple Python versions, but to do so you cannot use computed requirements - you must instead use conditional requirements.

    Attached is a patch to do this.

    Unfortunately, sufficiently old versions of pip and setuptools don't support computed requirements. I don't know the minimum versions that do, but pip 1.5.6 (the default on my Trusty install) does - the following is from a wheel built with the patch attached.:

    $ pip install ./Mako-1.0.1-py2.py3-none-any.whl 
    Unpacking ./Mako-1.0.1-py2.py3-none-any.whl
    Downloading/unpacking MarkupSafe>=0.9.2 (from Mako==1.0.1)
      Downloading MarkupSafe-0.23.tar.gz
      Running setup.py (path:/home/robertc/.virtualenvs/t/build/MarkupSafe/setup.py) egg_info for package MarkupSafe
        
    Installing collected packages: Mako, MarkupSafe
      Running setup.py install for MarkupSafe
        
        building 'markupsafe._speedups' extension
        x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
        x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/markupsafe/_speedups.o -o build/lib.linux-x86_64-2.7/markupsafe/_speedups.so
    Successfully installed Mako MarkupSafe
    Cleaning up...
    

    Attachments: mako-setup.patch

    bug high priority 
    opened by sqlalchemy-bot 44
  • Test failures with Python 3.8.0a2

    Test failures with Python 3.8.0a2

    Those are the test failures I get with Python 3.8.0a2:

    (I needed to apply https://github.com/sqlalchemy/mako/pull/286 first.)

    $ tox -e py37
    ...
    459 passed, 5 skipped, 2 warnings in 11.29 seconds
      py37: commands succeeded
      congratulations :)
    $ tox -e py38
    ...
    FAILED test/test_ast.py::AstParseTest::test_argument_list
    FAILED test/test_ast.py::AstParseTest::test_expr_generate
    FAILED test/test_cache.py::CacheTest::test_dynamic_key_with_funcargs
    FAILED test/test_cache.py::BeakerCacheTest::test_dynamic_key_with_funcargs
    FAILED test/test_cache.py::DogpileCacheTest::test_dynamic_key_with_funcargs
    FAILED test/test_cmd.py::CmdTest::test_file_rt_err
    FAILED test/test_cmd.py::CmdTest::test_file_syntax_err
    FAILED test/test_cmd.py::CmdTest::test_stdin_rt_err
    FAILED test/test_cmd.py::CmdTest::test_stdin_syntax_err
    FAILED test/test_def.py::DefTest::test_def_py3k_args
    FAILED test/test_def.py::NestedDefTest::test_nested_with_args
    FAILED test/test_exceptions.py::ExceptionsTest::test_custom_tback
    FAILED test/test_exceptions.py::ExceptionsTest::test_format_closures
    FAILED test/test_exceptions.py::ExceptionsTest::test_format_exceptions_no_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_format_exceptions_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_html_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_py_unicode_error_html_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_py_utf8_html_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_tback_no_trace_from_py_file
    FAILED test/test_exceptions.py::ExceptionsTest::test_tback_trace_from_py_file
    FAILED test/test_exceptions.py::ExceptionsTest::test_text_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_format_exceptions_no_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_format_exceptions_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_html_error_template_no_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_html_error_template_pygments
    FAILED test/test_inheritance.py::InheritanceTest::test_pageargs
    FAILED test/test_inheritance.py::InheritanceTest::test_pageargs_2
    FAILED test/test_inheritance.py::InheritanceTest::test_pageargs_err
    FAILED test/test_lexer.py::LexerTest::test_crlf
    FAILED test/test_template.py::EncodingTest::test_escapes_html_tags
    FAILED test/test_template.py::EncodingTest::test_unicode_file_lookup
    FAILED test/test_template.py::EncodingTest::test_unicode_literal_in_def
    FAILED test/test_template.py::PageArgsTest::test_basic
    FAILED test/test_template.py::PageArgsTest::test_builtin_names_dont_clobber_defaults_in_includes
    FAILED test/test_template.py::PageArgsTest::test_with_context
    ...
    35 failed, 424 passed, 5 skipped, 1 warnings in 11.02 seconds
    ...
    ERROR:   py38: commands failed
    
    Full log
    $ tox -e py38
    GLOB sdist-make: .../mako/setup.py
    py38 create: .../mako/.tox/py38
    py38 installdeps: pytest, mock, beaker, markupsafe, pygments, babel, dogpile.cache, lingua<4
    py38 inst: .../mako/.tox/dist/Mako-1.0.8.dev0.zip
    py38 installed: atomicwrites==1.3.0,attrs==19.1.0,Babel==2.6.0,Beaker==1.10.1,Chameleon==3.6,decorator==4.4.0,dogpile.cache==0.7.1,lingua==3.12,Mako==1.0.8.dev0,MarkupSafe==1.1.1,mock==2.0.0,more-itertools==6.0.0,pbr==5.1.3,pluggy==0.9.0,polib==1.1.0,py==1.8.0,Pygments==2.3.1,pytest==4.3.1,pytz==2018.9,six==1.12.0
    py38 run-test-pre: PYTHONHASHSEED='442732848'
    py38 runtests: commands[0] | py.test
    ================================== test session starts ===================================
    platform linux -- Python 3.8.0a2, pytest-4.3.1, py-1.8.0, pluggy-0.9.0 -- .../mako/.tox/py38/bin/python
    cachedir: .tox/py38/.pytest_cache
    rootdir: .../mako, inifile: setup.cfg
    collected 464 items                                                                      
    
    test/test_ast.py::AstParseTest::test_argument_list FAILED                          [  0%]
    test/test_ast.py::AstParseTest::test_expr_generate FAILED                          [  0%]
    test/test_ast.py::AstParseTest::test_function_decl PASSED                          [  0%]
    test/test_ast.py::AstParseTest::test_function_decl_2 PASSED                        [  0%]
    test/test_ast.py::AstParseTest::test_function_decl_3 PASSED                        [  1%]
    test/test_ast.py::AstParseTest::test_locate_identifiers PASSED                     [  1%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_10 PASSED                  [  1%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_11 PASSED                  [  1%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_12 PASSED                  [  1%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_13 PASSED                  [  2%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_14 PASSED                  [  2%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_15 SKIPPED                 [  2%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_16 PASSED                  [  2%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_17 PASSED                  [  3%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_2 PASSED                   [  3%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_3 PASSED                   [  3%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_4 PASSED                   [  3%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_5 PASSED                   [  3%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_6 PASSED                   [  4%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_7 PASSED                   [  4%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_8 PASSED                   [  4%]
    test/test_ast.py::AstParseTest::test_locate_identifiers_9 PASSED                   [  4%]
    test/test_ast.py::AstParseTest::test_no_global_imports PASSED                      [  4%]
    test/test_ast.py::AstParseTest::test_python_fragment PASSED                        [  5%]
    test/test_block.py::BlockTest::test_anon_in_anon PASSED                            [  5%]
    test/test_block.py::BlockTest::test_anon_in_named PASSED                           [  5%]
    test/test_block.py::BlockTest::test_anonymous_block_in_call PASSED                 [  5%]
    test/test_block.py::BlockTest::test_anonymous_block_namespace_raises PASSED        [  6%]
    test/test_block.py::BlockTest::test_block_args PASSED                              [  6%]
    test/test_block.py::BlockTest::test_block_args_contextual PASSED                   [  6%]
    test/test_block.py::BlockTest::test_block_overridden_by_def PASSED                 [  6%]
    test/test_block.py::BlockTest::test_block_pageargs PASSED                          [  6%]
    test/test_block.py::BlockTest::test_block_pageargs_contextual PASSED               [  7%]
    test/test_block.py::BlockTest::test_block_variables_contextual PASSED              [  7%]
    test/test_block.py::BlockTest::test_conditional PASSED                             [  7%]
    test/test_block.py::BlockTest::test_def_overridden_by_block PASSED                 [  7%]
    test/test_block.py::BlockTest::test_filter PASSED                                  [  7%]
    test/test_block.py::BlockTest::test_inherited_block_nested_both PASSED             [  8%]
    test/test_block.py::BlockTest::test_inherited_block_nested_inner_only PASSED       [  8%]
    test/test_block.py::BlockTest::test_inherited_block_no_render PASSED               [  8%]
    test/test_block.py::BlockTest::test_iteration PASSED                               [  8%]
    test/test_block.py::BlockTest::test_name_collision_block_def_toplevel PASSED       [  9%]
    test/test_block.py::BlockTest::test_name_collision_blocks_nested_block PASSED      [  9%]
    test/test_block.py::BlockTest::test_name_collision_blocks_nested_def PASSED        [  9%]
    test/test_block.py::BlockTest::test_name_collision_blocks_toplevel PASSED          [  9%]
    test/test_block.py::BlockTest::test_name_collision_def_block_toplevel PASSED       [  9%]
    test/test_block.py::BlockTest::test_named_block_in_call PASSED                     [ 10%]
    test/test_block.py::BlockTest::test_named_block_renders PASSED                     [ 10%]
    test/test_block.py::BlockTest::test_named_in_anon PASSED                           [ 10%]
    test/test_block.py::BlockTest::test_named_in_named PASSED                          [ 10%]
    test/test_block.py::BlockTest::test_nested_dupe_names_raise PASSED                 [ 10%]
    test/test_block.py::BlockTest::test_no_conflict_nested_one PASSED                  [ 11%]
    test/test_block.py::BlockTest::test_no_named_in_def PASSED                         [ 11%]
    test/test_block.py::BlockTest::test_noninherited_block_no_render PASSED            [ 11%]
    test/test_block.py::BlockTest::test_two_levels_one PASSED                          [ 11%]
    test/test_cache.py::CacheTest::test_args_complete PASSED                           [ 12%]
    test/test_cache.py::CacheTest::test_buffered PASSED                                [ 12%]
    test/test_cache.py::CacheTest::test_cache_enable PASSED                            [ 12%]
    test/test_cache.py::CacheTest::test_custom_args_block PASSED                       [ 12%]
    test/test_cache.py::CacheTest::test_custom_args_def PASSED                         [ 12%]
    test/test_cache.py::CacheTest::test_custom_args_page PASSED                        [ 13%]
    test/test_cache.py::CacheTest::test_def PASSED                                     [ 13%]
    test/test_cache.py::CacheTest::test_dynamic_key_with_context PASSED                [ 13%]
    test/test_cache.py::CacheTest::test_dynamic_key_with_funcargs FAILED               [ 13%]
    test/test_cache.py::CacheTest::test_dynamic_key_with_imports PASSED                [ 14%]
    test/test_cache.py::CacheTest::test_fileargs_deftag PASSED                         [ 14%]
    test/test_cache.py::CacheTest::test_fileargs_implicit PASSED                       [ 14%]
    test/test_cache.py::CacheTest::test_fileargs_lookup PASSED                         [ 14%]
    test/test_cache.py::CacheTest::test_fileargs_pagetag PASSED                        [ 14%]
    test/test_cache.py::CacheTest::test_invalidate PASSED                              [ 15%]
    test/test_cache.py::CacheTest::test_load_from_expired PASSED                       [ 15%]
    test/test_cache.py::CacheTest::test_lookup PASSED                                  [ 15%]
    test/test_cache.py::CacheTest::test_namespace_access PASSED                        [ 15%]
    test/test_cache.py::CacheTest::test_nested_def PASSED                              [ 15%]
    test/test_cache.py::CacheTest::test_page PASSED                                    [ 16%]
    test/test_cache.py::CacheTest::test_pass_context PASSED                            [ 16%]
    test/test_cache.py::BeakerCacheTest::test_args_complete PASSED                     [ 16%]
    test/test_cache.py::BeakerCacheTest::test_buffered PASSED                          [ 16%]
    test/test_cache.py::BeakerCacheTest::test_cache_enable PASSED                      [ 17%]
    test/test_cache.py::BeakerCacheTest::test_cache_uses_current_context PASSED        [ 17%]
    test/test_cache.py::BeakerCacheTest::test_custom_args_block PASSED                 [ 17%]
    test/test_cache.py::BeakerCacheTest::test_custom_args_def PASSED                   [ 17%]
    test/test_cache.py::BeakerCacheTest::test_custom_args_page PASSED                  [ 17%]
    test/test_cache.py::BeakerCacheTest::test_def PASSED                               [ 18%]
    test/test_cache.py::BeakerCacheTest::test_dynamic_key_with_context PASSED          [ 18%]
    test/test_cache.py::BeakerCacheTest::test_dynamic_key_with_funcargs FAILED         [ 18%]
    test/test_cache.py::BeakerCacheTest::test_dynamic_key_with_imports PASSED          [ 18%]
    test/test_cache.py::BeakerCacheTest::test_fileargs_deftag PASSED                   [ 18%]
    test/test_cache.py::BeakerCacheTest::test_fileargs_implicit PASSED                 [ 19%]
    test/test_cache.py::BeakerCacheTest::test_fileargs_lookup PASSED                   [ 19%]
    test/test_cache.py::BeakerCacheTest::test_fileargs_pagetag PASSED                  [ 19%]
    test/test_cache.py::BeakerCacheTest::test_invalidate PASSED                        [ 19%]
    test/test_cache.py::BeakerCacheTest::test_load_from_expired PASSED                 [ 20%]
    test/test_cache.py::BeakerCacheTest::test_lookup PASSED                            [ 20%]
    test/test_cache.py::BeakerCacheTest::test_namespace_access PASSED                  [ 20%]
    test/test_cache.py::BeakerCacheTest::test_nested_def PASSED                        [ 20%]
    test/test_cache.py::BeakerCacheTest::test_page PASSED                              [ 20%]
    test/test_cache.py::BeakerCacheTest::test_pass_context PASSED                      [ 21%]
    test/test_cache.py::BeakerCacheTest::test_region PASSED                            [ 21%]
    test/test_cache.py::DogpileCacheTest::test_args_complete PASSED                    [ 21%]
    test/test_cache.py::DogpileCacheTest::test_buffered PASSED                         [ 21%]
    test/test_cache.py::DogpileCacheTest::test_cache_enable PASSED                     [ 21%]
    test/test_cache.py::DogpileCacheTest::test_cache_uses_current_context PASSED       [ 22%]
    test/test_cache.py::DogpileCacheTest::test_custom_args_block PASSED                [ 22%]
    test/test_cache.py::DogpileCacheTest::test_custom_args_def PASSED                  [ 22%]
    test/test_cache.py::DogpileCacheTest::test_custom_args_page PASSED                 [ 22%]
    test/test_cache.py::DogpileCacheTest::test_def PASSED                              [ 23%]
    test/test_cache.py::DogpileCacheTest::test_dynamic_key_with_context PASSED         [ 23%]
    test/test_cache.py::DogpileCacheTest::test_dynamic_key_with_funcargs FAILED        [ 23%]
    test/test_cache.py::DogpileCacheTest::test_dynamic_key_with_imports PASSED         [ 23%]
    test/test_cache.py::DogpileCacheTest::test_fileargs_deftag PASSED                  [ 23%]
    test/test_cache.py::DogpileCacheTest::test_fileargs_implicit PASSED                [ 24%]
    test/test_cache.py::DogpileCacheTest::test_fileargs_lookup PASSED                  [ 24%]
    test/test_cache.py::DogpileCacheTest::test_fileargs_pagetag PASSED                 [ 24%]
    test/test_cache.py::DogpileCacheTest::test_invalidate PASSED                       [ 24%]
    test/test_cache.py::DogpileCacheTest::test_load_from_expired PASSED                [ 25%]
    test/test_cache.py::DogpileCacheTest::test_lookup PASSED                           [ 25%]
    test/test_cache.py::DogpileCacheTest::test_namespace_access PASSED                 [ 25%]
    test/test_cache.py::DogpileCacheTest::test_nested_def PASSED                       [ 25%]
    test/test_cache.py::DogpileCacheTest::test_page PASSED                             [ 25%]
    test/test_cache.py::DogpileCacheTest::test_pass_context PASSED                     [ 26%]
    test/test_cache.py::DogpileCacheTest::test_region PASSED                           [ 26%]
    test/test_call.py::CallTest::test_call PASSED                                      [ 26%]
    test/test_call.py::CallTest::test_call_in_nested PASSED                            [ 26%]
    test/test_call.py::CallTest::test_call_in_nested_2 PASSED                          [ 26%]
    test/test_call.py::CallTest::test_ccall_caller PASSED                              [ 27%]
    test/test_call.py::CallTest::test_chained_call PASSED                              [ 27%]
    test/test_call.py::CallTest::test_chained_call_in_nested PASSED                    [ 27%]
    test/test_call.py::CallTest::test_composed_def PASSED                              [ 27%]
    test/test_call.py::CallTest::test_compound_call PASSED                             [ 28%]
    test/test_call.py::CallTest::test_conditional_call PASSED                          [ 28%]
    test/test_call.py::CallTest::test_nested_call PASSED                               [ 28%]
    test/test_call.py::CallTest::test_nested_call_2 PASSED                             [ 28%]
    test/test_call.py::CallTest::test_nested_call_3 PASSED                             [ 28%]
    test/test_call.py::CallTest::test_nested_call_4 PASSED                             [ 29%]
    test/test_call.py::CallTest::test_new_syntax PASSED                                [ 29%]
    test/test_call.py::CallTest::test_regular_defs PASSED                              [ 29%]
    test/test_call.py::CallTest::test_stack_pop PASSED                                 [ 29%]
    test/test_call.py::SelfCacheTest::test_basic PASSED                                [ 29%]
    test/test_cmd.py::CmdTest::test_file_notfound PASSED                               [ 30%]
    test/test_cmd.py::CmdTest::test_file_rt_err FAILED                                 [ 30%]
    test/test_cmd.py::CmdTest::test_file_success PASSED                                [ 30%]
    test/test_cmd.py::CmdTest::test_file_syntax_err FAILED                             [ 30%]
    test/test_cmd.py::CmdTest::test_stdin_rt_err FAILED                                [ 31%]
    test/test_cmd.py::CmdTest::test_stdin_success PASSED                               [ 31%]
    test/test_cmd.py::CmdTest::test_stdin_syntax_err FAILED                            [ 31%]
    test/test_decorators.py::DecoratorTest::test_nested PASSED                         [ 31%]
    test/test_decorators.py::DecoratorTest::test_nested_decorated_name PASSED          [ 31%]
    test/test_decorators.py::DecoratorTest::test_toplevel PASSED                       [ 32%]
    test/test_decorators.py::DecoratorTest::test_toplevel_contextual PASSED            [ 32%]
    test/test_decorators.py::DecoratorTest::test_toplevel_decorated_name PASSED        [ 32%]
    test/test_def.py::DefTest::test_def_args PASSED                                    [ 32%]
    test/test_def.py::DefTest::test_def_blankargs PASSED                               [ 32%]
    test/test_def.py::DefTest::test_def_noargs PASSED                                  [ 33%]
    test/test_def.py::DefTest::test_def_operations PASSED                              [ 33%]
    test/test_def.py::DefTest::test_def_py3k_args FAILED                               [ 33%]
    test/test_def.py::DefTest::test_inter_def PASSED                                   [ 33%]
    test/test_def.py::DefTest::test_toplevel PASSED                                    [ 34%]
    test/test_def.py::ScopeTest::test_canget_kwargs PASSED                             [ 34%]
    test/test_def.py::ScopeTest::test_inline_expression_from_arg_one PASSED            [ 34%]
    test/test_def.py::ScopeTest::test_interpret_expression_from_arg_two PASSED         [ 34%]
    test/test_def.py::ScopeTest::test_scope_eight PASSED                               [ 34%]
    test/test_def.py::ScopeTest::test_scope_eleven PASSED                              [ 35%]
    test/test_def.py::ScopeTest::test_scope_five PASSED                                [ 35%]
    test/test_def.py::ScopeTest::test_scope_four PASSED                                [ 35%]
    test/test_def.py::ScopeTest::test_scope_nine PASSED                                [ 35%]
    test/test_def.py::ScopeTest::test_scope_one PASSED                                 [ 35%]
    test/test_def.py::ScopeTest::test_scope_seven PASSED                               [ 36%]
    test/test_def.py::ScopeTest::test_scope_six PASSED                                 [ 36%]
    test/test_def.py::ScopeTest::test_scope_ten PASSED                                 [ 36%]
    test/test_def.py::ScopeTest::test_scope_two PASSED                                 [ 36%]
    test/test_def.py::ScopeTest::test_unbound_scope PASSED                             [ 37%]
    test/test_def.py::ScopeTest::test_unbound_scope_two PASSED                         [ 37%]
    test/test_def.py::NestedDefTest::test_nested_2 PASSED                              [ 37%]
    test/test_def.py::NestedDefTest::test_nested_def PASSED                            [ 37%]
    test/test_def.py::NestedDefTest::test_nested_def_2 PASSED                          [ 37%]
    test/test_def.py::NestedDefTest::test_nested_nested_def PASSED                     [ 38%]
    test/test_def.py::NestedDefTest::test_nested_nested_def_2 PASSED                   [ 38%]
    test/test_def.py::NestedDefTest::test_nested_with_args FAILED                      [ 38%]
    test/test_def.py::NestedDefTest::test_outer_scope PASSED                           [ 38%]
    test/test_def.py::ExceptionTest::test_handler PASSED                               [ 39%]
    test/test_def.py::ExceptionTest::test_raise PASSED                                 [ 39%]
    test/test_exceptions.py::ExceptionsTest::test_custom_tback FAILED                  [ 39%]
    test/test_exceptions.py::ExceptionsTest::test_format_closures FAILED               [ 39%]
    test/test_exceptions.py::ExceptionsTest::test_format_exceptions_no_pygments FAILED [ 39%]
    test/test_exceptions.py::ExceptionsTest::test_format_exceptions_pygments FAILED    [ 40%]
    test/test_exceptions.py::ExceptionsTest::test_html_error_template FAILED           [ 40%]
    test/test_exceptions.py::ExceptionsTest::test_py_unicode_error_html_error_template FAILED [ 40%]
    test/test_exceptions.py::ExceptionsTest::test_py_utf8_html_error_template FAILED   [ 40%]
    test/test_exceptions.py::ExceptionsTest::test_tback_no_trace_from_py_file FAILED   [ 40%]
    test/test_exceptions.py::ExceptionsTest::test_tback_trace_from_py_file FAILED      [ 41%]
    test/test_exceptions.py::ExceptionsTest::test_text_error_template FAILED           [ 41%]
    test/test_exceptions.py::ExceptionsTest::test_utf8_format_exceptions_no_pygments FAILED [ 41%]
    test/test_exceptions.py::ExceptionsTest::test_utf8_format_exceptions_pygments FAILED [ 41%]
    test/test_exceptions.py::ExceptionsTest::test_utf8_html_error_template_no_pygments FAILED [ 42%]
    test/test_exceptions.py::ExceptionsTest::test_utf8_html_error_template_pygments FAILED [ 42%]
    test/test_filters.py::FilterTest::test_basic PASSED                                [ 42%]
    test/test_filters.py::FilterTest::test_block_via_context PASSED                    [ 42%]
    test/test_filters.py::FilterTest::test_builtins PASSED                             [ 42%]
    test/test_filters.py::FilterTest::test_convert_str PASSED                          [ 43%]
    test/test_filters.py::FilterTest::test_custom_default PASSED                       [ 43%]
    test/test_filters.py::FilterTest::test_def PASSED                                  [ 43%]
    test/test_filters.py::FilterTest::test_def_via_context PASSED                      [ 43%]
    test/test_filters.py::FilterTest::test_encode_filter PASSED                        [ 43%]
    test/test_filters.py::FilterTest::test_encode_filter_non_str PASSED                [ 44%]
    test/test_filters.py::FilterTest::test_encode_filter_non_str_we_return_bytes SKIPPED [ 44%]
    test/test_filters.py::FilterTest::test_entity PASSED                               [ 44%]
    test/test_filters.py::FilterTest::test_expr PASSED                                 [ 44%]
    test/test_filters.py::FilterTest::test_global PASSED                               [ 45%]
    test/test_filters.py::FilterTest::test_import PASSED                               [ 45%]
    test/test_filters.py::FilterTest::test_import_2 PASSED                             [ 45%]
    test/test_filters.py::FilterTest::test_nflag PASSED                                [ 45%]
    test/test_filters.py::FilterTest::test_non_expression PASSED                       [ 45%]
    test/test_filters.py::FilterTest::test_quoting PASSED                              [ 46%]
    test/test_filters.py::FilterTest::test_quoting_non_unicode SKIPPED                 [ 46%]
    test/test_filters.py::FilterTest::test_text_via_context PASSED                     [ 46%]
    test/test_filters.py::FilterTest::test_url_escaping PASSED                         [ 46%]
    test/test_filters.py::FilterTest::test_url_escaping_non_unicode SKIPPED            [ 46%]
    test/test_filters.py::BufferTest::test_buffered_def PASSED                         [ 47%]
    test/test_filters.py::BufferTest::test_buffered_exception PASSED                   [ 47%]
    test/test_filters.py::BufferTest::test_capture PASSED                              [ 47%]
    test/test_filters.py::BufferTest::test_capture_ccall PASSED                        [ 47%]
    test/test_filters.py::BufferTest::test_capture_exception PASSED                    [ 48%]
    test/test_filters.py::BufferTest::test_unbuffered_def PASSED                       [ 48%]
    test/test_inheritance.py::InheritanceTest::test_basic PASSED                       [ 48%]
    test/test_inheritance.py::InheritanceTest::test_dynamic PASSED                     [ 48%]
    test/test_inheritance.py::InheritanceTest::test_in_call PASSED                     [ 48%]
    test/test_inheritance.py::InheritanceTest::test_includes PASSED                    [ 49%]
    test/test_inheritance.py::InheritanceTest::test_multilevel_nesting PASSED          [ 49%]
    test/test_inheritance.py::InheritanceTest::test_namespaces PASSED                  [ 49%]
    test/test_inheritance.py::InheritanceTest::test_pageargs FAILED                    [ 49%]
    test/test_inheritance.py::InheritanceTest::test_pageargs_2 FAILED                  [ 50%]
    test/test_inheritance.py::InheritanceTest::test_pageargs_err FAILED                [ 50%]
    test/test_inheritance.py::InheritanceTest::test_toplevel PASSED                    [ 50%]
    test/test_lexer.py::LexerTest::test_code PASSED                                    [ 50%]
    test/test_lexer.py::LexerTest::test_code_and_tags PASSED                           [ 50%]
    test/test_lexer.py::LexerTest::test_comment_after_statement PASSED                 [ 51%]
    test/test_lexer.py::LexerTest::test_comments PASSED                                [ 51%]
    test/test_lexer.py::LexerTest::test_control_lines PASSED                           [ 51%]
    test/test_lexer.py::LexerTest::test_control_lines_2 PASSED                         [ 51%]
    test/test_lexer.py::LexerTest::test_crlf FAILED                                    [ 51%]
    test/test_lexer.py::LexerTest::test_def_syntax PASSED                              [ 52%]
    test/test_lexer.py::LexerTest::test_def_syntax_2 PASSED                            [ 52%]
    test/test_lexer.py::LexerTest::test_docs PASSED                                    [ 52%]
    test/test_lexer.py::LexerTest::test_expr_in_attribute PASSED                       [ 52%]
    test/test_lexer.py::LexerTest::test_expression PASSED                              [ 53%]
    test/test_lexer.py::LexerTest::test_integration PASSED                             [ 53%]
    test/test_lexer.py::LexerTest::test_long_control_lines PASSED                      [ 53%]
    test/test_lexer.py::LexerTest::test_nesting PASSED                                 [ 53%]
    test/test_lexer.py::LexerTest::test_noexpr_allowed PASSED                          [ 53%]
    test/test_lexer.py::LexerTest::test_nonexistent_tag PASSED                         [ 54%]
    test/test_lexer.py::LexerTest::test_ns_tag_closed PASSED                           [ 54%]
    test/test_lexer.py::LexerTest::test_ns_tag_empty PASSED                            [ 54%]
    test/test_lexer.py::LexerTest::test_ns_tag_open PASSED                             [ 54%]
    test/test_lexer.py::LexerTest::test_old_multiline_comment PASSED                   [ 54%]
    test/test_lexer.py::LexerTest::test_onlyclosed_tag PASSED                          [ 55%]
    test/test_lexer.py::LexerTest::test_pagetag PASSED                                 [ 55%]
    test/test_lexer.py::LexerTest::test_percent_escape PASSED                          [ 55%]
    test/test_lexer.py::LexerTest::test_preprocess PASSED                              [ 55%]
    test/test_lexer.py::LexerTest::test_ternary_control PASSED                         [ 56%]
    test/test_lexer.py::LexerTest::test_text_and_tag PASSED                            [ 56%]
    test/test_lexer.py::LexerTest::test_text_tag PASSED                                [ 56%]
    test/test_lexer.py::LexerTest::test_tricky_code PASSED                             [ 56%]
    test/test_lexer.py::LexerTest::test_tricky_code_2 PASSED                           [ 56%]
    test/test_lexer.py::LexerTest::test_tricky_code_3 PASSED                           [ 57%]
    test/test_lexer.py::LexerTest::test_tricky_code_4 PASSED                           [ 57%]
    test/test_lexer.py::LexerTest::test_tricky_code_5 PASSED                           [ 57%]
    test/test_lexer.py::LexerTest::test_tricky_code_6 PASSED                           [ 57%]
    test/test_lexer.py::LexerTest::test_tricky_expression PASSED                       [ 57%]
    test/test_lexer.py::LexerTest::test_unclosed_tag PASSED                            [ 58%]
    test/test_lexer.py::LexerTest::test_unmatched_control PASSED                       [ 58%]
    test/test_lexer.py::LexerTest::test_unmatched_control_2 PASSED                     [ 58%]
    test/test_lexer.py::LexerTest::test_unmatched_control_3 PASSED                     [ 58%]
    test/test_lexer.py::LexerTest::test_unmatched_tag PASSED                           [ 59%]
    test/test_lexer.py::LexerTest::test_whitespace_equals PASSED                       [ 59%]
    test/test_lexer.py::LexerTest::test_wrongcase_tag PASSED                           [ 59%]
    test/test_lookup.py::LookupTest::test_basic PASSED                                 [ 59%]
    test/test_lookup.py::LookupTest::test_check_not_found PASSED                       [ 59%]
    test/test_lookup.py::LookupTest::test_directory_lookup PASSED                      [ 60%]
    test/test_lookup.py::LookupTest::test_dont_accept_relative_outside_of_root PASSED  [ 60%]
    test/test_lookup.py::LookupTest::test_no_lookup PASSED                             [ 60%]
    test/test_lookup.py::LookupTest::test_subdir PASSED                                [ 60%]
    test/test_lookup.py::LookupTest::test_updir PASSED                                 [ 60%]
    test/test_lookup.py::LookupTest::test_uri_adjust PASSED                            [ 61%]
    test/test_lookup.py::LookupTest::test_uri_cache PASSED                             [ 61%]
    test/test_loop.py::TestLoop::test__FOR_LOOP PASSED                                 [ 61%]
    test/test_loop.py::TestLoop::test_loop_demo PASSED                                 [ 61%]
    test/test_loop.py::TestLoop::test_nested_loops PASSED                              [ 62%]
    test/test_loop.py::TestLoop::test_no_loop PASSED                                   [ 62%]
    test/test_loop.py::TestLoop::test_out_of_context_access PASSED                     [ 62%]
    test/test_loop.py::TestLoop::test_parent_loops PASSED                              [ 62%]
    test/test_loop.py::TestLoopStack::test__pop PASSED                                 [ 62%]
    test/test_loop.py::TestLoopStack::test__push PASSED                                [ 63%]
    test/test_loop.py::TestLoopStack::test__top PASSED                                 [ 63%]
    test/test_loop.py::TestLoopStack::test_enter PASSED                                [ 63%]
    test/test_loop.py::TestLoopStack::test_exit PASSED                                 [ 63%]
    test/test_loop.py::TestLoopContext::test___len__ PASSED                            [ 64%]
    test/test_loop.py::TestLoopContext::test_cycle PASSED                              [ 64%]
    test/test_loop.py::TestLoopContext::test_even PASSED                               [ 64%]
    test/test_loop.py::TestLoopContext::test_first PASSED                              [ 64%]
    test/test_loop.py::TestLoopContext::test_index PASSED                              [ 64%]
    test/test_loop.py::TestLoopContext::test_last PASSED                               [ 65%]
    test/test_loop.py::TestLoopContext::test_odd PASSED                                [ 65%]
    test/test_loop.py::TestLoopContext::test_reverse_index PASSED                      [ 65%]
    test/test_loop.py::TestLoopFlags::test_loop_disabled_lookup PASSED                 [ 65%]
    test/test_loop.py::TestLoopFlags::test_loop_disabled_override_lookup PASSED        [ 65%]
    test/test_loop.py::TestLoopFlags::test_loop_disabled_override_template PASSED      [ 66%]
    test/test_loop.py::TestLoopFlags::test_loop_disabled_template PASSED               [ 66%]
    test/test_loop.py::TestLoopFlags::test_loop_enabled_override_lookup PASSED         [ 66%]
    test/test_loop.py::TestLoopFlags::test_loop_enabled_override_template PASSED       [ 66%]
    test/test_lru.py::LRUTest::testlru PASSED                                          [ 67%]
    test/test_namespace.py::NamespaceTest::test_attr PASSED                            [ 67%]
    test/test_namespace.py::NamespaceTest::test_attr_raise PASSED                      [ 67%]
    test/test_namespace.py::NamespaceTest::test_ccall PASSED                           [ 67%]
    test/test_namespace.py::NamespaceTest::test_ccall_2 PASSED                         [ 67%]
    test/test_namespace.py::NamespaceTest::test_ccall_import PASSED                    [ 68%]
    test/test_namespace.py::NamespaceTest::test_closure_import PASSED                  [ 68%]
    test/test_namespace.py::NamespaceTest::test_context PASSED                         [ 68%]
    test/test_namespace.py::NamespaceTest::test_custom_tag_1 PASSED                    [ 68%]
    test/test_namespace.py::NamespaceTest::test_custom_tag_2 PASSED                    [ 68%]
    test/test_namespace.py::NamespaceTest::test_custom_tag_3 PASSED                    [ 69%]
    test/test_namespace.py::NamespaceTest::test_custom_tag_case_sensitive PASSED       [ 69%]
    test/test_namespace.py::NamespaceTest::test_dont_pollute_self PASSED               [ 69%]
    test/test_namespace.py::NamespaceTest::test_dynamic PASSED                         [ 69%]
    test/test_namespace.py::NamespaceTest::test_expr_grouping PASSED                   [ 70%]
    test/test_namespace.py::NamespaceTest::test_getattr PASSED                         [ 70%]
    test/test_namespace.py::NamespaceTest::test_import PASSED                          [ 70%]
    test/test_namespace.py::NamespaceTest::test_import_calledfromdef PASSED            [ 70%]
    test/test_namespace.py::NamespaceTest::test_import_local PASSED                    [ 70%]
    test/test_namespace.py::NamespaceTest::test_in_def PASSED                          [ 71%]
    test/test_namespace.py::NamespaceTest::test_in_remote_def PASSED                   [ 71%]
    test/test_namespace.py::NamespaceTest::test_inheritance PASSED                     [ 71%]
    test/test_namespace.py::NamespaceTest::test_inheritance_two PASSED                 [ 71%]
    test/test_namespace.py::NamespaceTest::test_inline_arguments PASSED                [ 71%]
    test/test_namespace.py::NamespaceTest::test_inline_assignment PASSED               [ 72%]
    test/test_namespace.py::NamespaceTest::test_inline_crossreference PASSED           [ 72%]
    test/test_namespace.py::NamespaceTest::test_inline_not_duped PASSED                [ 72%]
    test/test_namespace.py::NamespaceTest::test_module PASSED                          [ 72%]
    test/test_namespace.py::NamespaceTest::test_module_2 PASSED                        [ 73%]
    test/test_namespace.py::NamespaceTest::test_module_imports PASSED                  [ 73%]
    test/test_namespace.py::NamespaceTest::test_module_imports_2 PASSED                [ 73%]
    test/test_namespace.py::NamespaceTest::test_overload PASSED                        [ 73%]
    test/test_namespace.py::NamespaceTest::test_template PASSED                        [ 73%]
    test/test_pygen.py::GeneratePythonTest::test_backslash_line PASSED                 [ 74%]
    test/test_pygen.py::GeneratePythonTest::test_false_unindentor PASSED               [ 74%]
    test/test_pygen.py::GeneratePythonTest::test_generate_adjusted PASSED              [ 74%]
    test/test_pygen.py::GeneratePythonTest::test_generate_combo PASSED                 [ 74%]
    test/test_pygen.py::GeneratePythonTest::test_generate_normal PASSED                [ 75%]
    test/test_pygen.py::GeneratePythonTest::test_multi_line PASSED                     [ 75%]
    test/test_pygen.py::WhitespaceTest::test_basic PASSED                              [ 75%]
    test/test_pygen.py::WhitespaceTest::test_blank_lines PASSED                        [ 75%]
    test/test_pygen.py::WhitespaceTest::test_open_quotes_with_pound PASSED             [ 75%]
    test/test_pygen.py::WhitespaceTest::test_quote_with_comments PASSED                [ 76%]
    test/test_pygen.py::WhitespaceTest::test_quotes PASSED                             [ 76%]
    test/test_pygen.py::WhitespaceTest::test_quotes_with_pound PASSED                  [ 76%]
    test/test_runtime.py::ContextTest::test_locals_kwargs PASSED                       [ 76%]
    test/test_template.py::EncodingTest::test_bytestring_passthru SKIPPED              [ 76%]
    test/test_template.py::EncodingTest::test_encoding PASSED                          [ 77%]
    test/test_template.py::EncodingTest::test_encoding_doesnt_conflict PASSED          [ 77%]
    test/test_template.py::EncodingTest::test_encoding_errors PASSED                   [ 77%]
    test/test_template.py::EncodingTest::test_escapes_html_tags FAILED                 [ 77%]
    test/test_template.py::EncodingTest::test_input_encoding PASSED                    [ 78%]
    test/test_template.py::EncodingTest::test_raw_strings PASSED                       [ 78%]
    test/test_template.py::EncodingTest::test_read_unicode PASSED                      [ 78%]
    test/test_template.py::EncodingTest::test_unicode PASSED                           [ 78%]
    test/test_template.py::EncodingTest::test_unicode_arg PASSED                       [ 78%]
    test/test_template.py::EncodingTest::test_unicode_bom PASSED                       [ 79%]
    test/test_template.py::EncodingTest::test_unicode_file PASSED                      [ 79%]
    test/test_template.py::EncodingTest::test_unicode_file_code PASSED                 [ 79%]
    test/test_template.py::EncodingTest::test_unicode_file_lookup FAILED               [ 79%]
    test/test_template.py::EncodingTest::test_unicode_literal_in_code PASSED           [ 79%]
    test/test_template.py::EncodingTest::test_unicode_literal_in_controlline PASSED    [ 80%]
    test/test_template.py::EncodingTest::test_unicode_literal_in_def FAILED            [ 80%]
    test/test_template.py::EncodingTest::test_unicode_literal_in_expr PASSED           [ 80%]
    test/test_template.py::EncodingTest::test_unicode_literal_in_expr_file PASSED      [ 80%]
    test/test_template.py::EncodingTest::test_unicode_literal_in_tag PASSED            [ 81%]
    test/test_template.py::EncodingTest::test_unicode_memory PASSED                    [ 81%]
    test/test_template.py::EncodingTest::test_unicode_text PASSED                      [ 81%]
    test/test_template.py::EncodingTest::test_unicode_text_ccall PASSED                [ 81%]
    test/test_template.py::PageArgsTest::test_basic FAILED                             [ 81%]
    test/test_template.py::PageArgsTest::test_builtin_names_dont_clobber_defaults_in_includes FAILED [ 82%]
    test/test_template.py::PageArgsTest::test_canuse_builtin_names PASSED              [ 82%]
    test/test_template.py::PageArgsTest::test_context_small PASSED                     [ 82%]
    test/test_template.py::PageArgsTest::test_dict_locals PASSED                       [ 82%]
    test/test_template.py::PageArgsTest::test_includes PASSED                          [ 82%]
    test/test_template.py::PageArgsTest::test_inherits PASSED                          [ 83%]
    test/test_template.py::PageArgsTest::test_overrides_builtins PASSED                [ 83%]
    test/test_template.py::PageArgsTest::test_with_context FAILED                      [ 83%]
    test/test_template.py::IncludeTest::test_basic PASSED                              [ 83%]
    test/test_template.py::IncludeTest::test_include_error_handler PASSED              [ 84%]
    test/test_template.py::IncludeTest::test_include_withargs PASSED                   [ 84%]
    test/test_template.py::IncludeTest::test_localargs PASSED                          [ 84%]
    test/test_template.py::IncludeTest::test_viakwargs PASSED                          [ 84%]
    test/test_template.py::IncludeTest::test_within_ccall PASSED                       [ 84%]
    test/test_template.py::UndefinedVarsTest::test_expression_declared PASSED          [ 85%]
    test/test_template.py::UndefinedVarsTest::test_list_comprehensions_plus_undeclared_nonstrict PASSED [ 85%]
    test/test_template.py::UndefinedVarsTest::test_list_comprehensions_plus_undeclared_strict PASSED [ 85%]
    test/test_template.py::UndefinedVarsTest::test_strict PASSED                       [ 85%]
    test/test_template.py::UndefinedVarsTest::test_traditional_assignment_plus_undeclared PASSED [ 85%]
    test/test_template.py::UndefinedVarsTest::test_undefined PASSED                    [ 86%]
    test/test_template.py::StopRenderingTest::test_return_in_template PASSED           [ 86%]
    test/test_template.py::ReservedNameTest::test_exclude_loop_context PASSED          [ 86%]
    test/test_template.py::ReservedNameTest::test_exclude_loop_template PASSED         [ 86%]
    test/test_template.py::ReservedNameTest::test_names_in_template PASSED             [ 87%]
    test/test_template.py::ReservedNameTest::test_names_on_context PASSED              [ 87%]
    test/test_template.py::ControlTest::test_blank_control_1 PASSED                    [ 87%]
    test/test_template.py::ControlTest::test_blank_control_2 PASSED                    [ 87%]
    test/test_template.py::ControlTest::test_blank_control_3 PASSED                    [ 87%]
    test/test_template.py::ControlTest::test_blank_control_4 PASSED                    [ 88%]
    test/test_template.py::ControlTest::test_blank_control_5 PASSED                    [ 88%]
    test/test_template.py::ControlTest::test_blank_control_6 PASSED                    [ 88%]
    test/test_template.py::ControlTest::test_blank_control_7 PASSED                    [ 88%]
    test/test_template.py::ControlTest::test_blank_control_8 PASSED                    [ 89%]
    test/test_template.py::ControlTest::test_commented_blank_control_1 PASSED          [ 89%]
    test/test_template.py::ControlTest::test_commented_blank_control_2 PASSED          [ 89%]
    test/test_template.py::ControlTest::test_commented_blank_control_3 PASSED          [ 89%]
    test/test_template.py::ControlTest::test_commented_blank_control_4 PASSED          [ 89%]
    test/test_template.py::ControlTest::test_commented_blank_control_5 PASSED          [ 90%]
    test/test_template.py::ControlTest::test_commented_blank_control_6 PASSED          [ 90%]
    test/test_template.py::ControlTest::test_commented_blank_control_7 PASSED          [ 90%]
    test/test_template.py::ControlTest::test_commented_blank_control_8 PASSED          [ 90%]
    test/test_template.py::ControlTest::test_control PASSED                            [ 90%]
    test/test_template.py::ControlTest::test_multiline_control PASSED                  [ 91%]
    test/test_template.py::GlobalsTest::test_globals PASSED                            [ 91%]
    test/test_template.py::RichTracebackTest::test_unicode_file_runtime PASSED         [ 91%]
    test/test_template.py::RichTracebackTest::test_unicode_file_syntax PASSED          [ 91%]
    test/test_template.py::RichTracebackTest::test_unicode_memory_runtime PASSED       [ 92%]
    test/test_template.py::RichTracebackTest::test_unicode_memory_syntax PASSED        [ 92%]
    test/test_template.py::RichTracebackTest::test_utf8_file_runtime PASSED            [ 92%]
    test/test_template.py::RichTracebackTest::test_utf8_file_syntax PASSED             [ 92%]
    test/test_template.py::RichTracebackTest::test_utf8_memory_runtime PASSED          [ 92%]
    test/test_template.py::RichTracebackTest::test_utf8_memory_syntax PASSED           [ 93%]
    test/test_template.py::ModuleDirTest::test_basic PASSED                            [ 93%]
    test/test_template.py::ModuleDirTest::test_callable PASSED                         [ 93%]
    test/test_template.py::ModuleDirTest::test_custom_writer PASSED                    [ 93%]
    test/test_template.py::FilenameToURITest::test_dont_accept_relative_outside_of_root PASSED [ 93%]
    test/test_template.py::FilenameToURITest::test_posix_paths PASSED                  [ 94%]
    test/test_template.py::FilenameToURITest::test_windows_paths PASSED                [ 94%]
    test/test_template.py::ModuleTemplateTest::test_module_roundtrip PASSED            [ 94%]
    test/test_template.py::TestTemplateAPI::test_metadata PASSED                       [ 94%]
    test/test_template.py::TestTemplateAPI::test_metadata_two PASSED                   [ 95%]
    test/test_template.py::PreprocessTest::test_old_comments PASSED                    [ 95%]
    test/test_template.py::LexerTest::test_via_lookup PASSED                           [ 95%]
    test/test_template.py::LexerTest::test_via_template PASSED                         [ 95%]
    test/test_template.py::FuturesTest::test_future_import PASSED                      [ 95%]
    test/test_tgplugin.py::TestTGPlugin::test_basic PASSED                             [ 96%]
    test/test_tgplugin.py::TestTGPlugin::test_basic_dot PASSED                         [ 96%]
    test/test_tgplugin.py::TestTGPlugin::test_render PASSED                            [ 96%]
    test/test_tgplugin.py::TestTGPlugin::test_string PASSED                            [ 96%]
    test/test_tgplugin.py::TestTGPlugin::test_subdir PASSED                            [ 96%]
    test/test_tgplugin.py::TestTGPlugin::test_subdir_dot PASSED                        [ 97%]
    test/test_util.py::UtilTest::test_fast_buffer_encoded PASSED                       [ 97%]
    test/test_util.py::UtilTest::test_fast_buffer_truncate PASSED                      [ 97%]
    test/test_util.py::UtilTest::test_fast_buffer_write PASSED                         [ 97%]
    test/test_util.py::UtilTest::test_load_module PASSED                               [ 98%]
    test/test_util.py::UtilTest::test_load_plugin_failure PASSED                       [ 98%]
    test/test_util.py::UtilTest::test_read_file PASSED                                 [ 98%]
    test/ext/test_babelplugin.py::Test_extract::test_parse_python_expression PASSED    [ 98%]
    test/ext/test_babelplugin.py::Test_extract::test_python_gettext_call PASSED        [ 98%]
    test/ext/test_babelplugin.py::Test_extract::test_translator_comment PASSED         [ 99%]
    test/ext/test_babelplugin.py::ExtractMakoTestCase::test_extract PASSED             [ 99%]
    test/ext/test_babelplugin.py::ExtractMakoTestCase::test_extract_cp1251 PASSED      [ 99%]
    test/ext/test_babelplugin.py::ExtractMakoTestCase::test_extract_utf8 PASSED        [ 99%]
    test/ext/test_linguaplugin.py::ExtractMakoTestCase::test_extract PASSED            [100%]
    
    ======================================== FAILURES ========================================
    ____________________________ AstParseTest.test_argument_list _____________________________
    Traceback (most recent call last):
      File ".../mako/test/test_ast.py", line 273, in test_argument_list
        eq_([x for x in parsed.args],
      File ".../mako/test/__init__.py", line 66, in eq_
        assert a == b, msg or "%r != %r" % (a, b)
    AssertionError: ['', '', '', '(x + )', 'context.get()'] != ['3', '5', "'hi'", '(x + 5)', "context.get('lala')"]
    ____________________________ AstParseTest.test_expr_generate _____________________________
    Traceback (most recent call last):
      File ".../mako/test/test_ast.py", line 327, in test_expr_generate
        eq_(eval(code, local_dict), eval(newcode, local_dict))
      File "<string>", line 1
        (str(((x + ( * y)) / foo.bar(, ))) + lala())
                                     ^
    SyntaxError: invalid syntax
    ________________________ CacheTest.test_dynamic_key_with_funcargs ________________________
    Traceback (most recent call last):
      File ".../mako/test/test_cache.py", line 216, in test_dynamic_key_with_funcargs
        t = Template("""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc497670", line 20
        def foo(num=):
                    ^
    SyntaxError: invalid syntax
    _____________________ BeakerCacheTest.test_dynamic_key_with_funcargs _____________________
    Traceback (most recent call last):
      File ".../mako/test/test_cache.py", line 216, in test_dynamic_key_with_funcargs
        t = Template("""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc4bfdc0", line 20
        def foo(num=):
                    ^
    SyntaxError: invalid syntax
    ____________________ DogpileCacheTest.test_dynamic_key_with_funcargs _____________________
    Traceback (most recent call last):
      File ".../mako/test/test_cache.py", line 216, in test_dynamic_key_with_funcargs
        t = Template("""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc48e100", line 20
        def foo(num=):
                    ^
    SyntaxError: invalid syntax
    ________________________________ CmdTest.test_file_rt_err ________________________________
    Traceback (most recent call last):
      File ".../mako/mako/cmd.py", line 67, in cmdline
        sys.stdout.write(template.render(**kw))
      File ".../mako/mako/template.py", line 462, in render
        return runtime._render(self, self.callable_, args, data)
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 899, in _exec_template
        callable_(context, *args, **kwargs)
      File "_home_churchyard_Dokumenty_RedHat_mako_test_templates_cmd_runtime_mako", line 21, in render_body
      File ".../mako/mako/runtime.py", line 226, in __str__
        raise NameError("Undefined")
    NameError: Undefined
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_cmd.py", line 62, in test_file_rt_err
        cmdline(["--var", "x=5",
      File ".../mako/mako/cmd.py", line 69, in cmdline
        _exit()
      File ".../mako/mako/cmd.py", line 21, in _exit
        sys.stderr.write(exceptions.text_error_template().render())
      File ".../mako/mako/exceptions.py", line 236, in text_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc367cd0", line 19
        def render_body(context,error=,traceback=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    ______________________________ CmdTest.test_file_syntax_err ______________________________
    Traceback (most recent call last):
      File ".../mako/mako/cmd.py", line 61, in cmdline
        template = Template(filename=filename, lookup=lookup, output_encoding=output_encoding)
      File ".../mako/mako/template.py", line 338, in __init__
        module = self._compile_from_file(path, filename)
      File ".../mako/mako/template.py", line 413, in _compile_from_file
        code, module = _compile_text(
      File ".../mako/mako/template.py", line 704, in _compile_text
        source, lexer = _compile(template, text, filename,
      File ".../mako/mako/template.py", line 685, in _compile
        node = lexer.parse()
      File ".../mako/mako/lexer.py", line 241, in parse
        if self.match_expression():
      File ".../mako/mako/lexer.py", line 393, in match_expression
        text, end = self.parse_until_text(True, r'\|', r'}')
      File ".../mako/mako/lexer.py", line 130, in parse_until_text
        raise exceptions.SyntaxException(
    mako.exceptions.SyntaxException: Expected: \|,} in file '.../mako/test/templates/cmd_syntax.mako' at line: 1 char: 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_cmd.py", line 53, in test_file_syntax_err
        cmdline(["--var", "x=5",
      File ".../mako/mako/cmd.py", line 63, in cmdline
        _exit()
      File ".../mako/mako/cmd.py", line 21, in _exit
        sys.stderr.write(exceptions.text_error_template().render())
      File ".../mako/mako/exceptions.py", line 236, in text_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc319490", line 19
        def render_body(context,error=,traceback=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    _______________________________ CmdTest.test_stdin_rt_err ________________________________
    Traceback (most recent call last):
      File ".../mako/mako/cmd.py", line 67, in cmdline
        sys.stdout.write(template.render(**kw))
      File ".../mako/mako/template.py", line 462, in render
        return runtime._render(self, self.callable_, args, data)
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 899, in _exec_template
        callable_(context, *args, **kwargs)
      File "memory:0x7fbfbc338cd0", line 21, in render_body
      File ".../mako/mako/runtime.py", line 226, in __str__
        raise NameError("Undefined")
    NameError: Undefined
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_cmd.py", line 38, in test_stdin_rt_err
        cmdline(["--var", "x=5", "-"])
      File ".../mako/mako/cmd.py", line 69, in cmdline
        _exit()
      File ".../mako/mako/cmd.py", line 21, in _exit
        sys.stderr.write(exceptions.text_error_template().render())
      File ".../mako/mako/exceptions.py", line 236, in text_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc33d370", line 19
        def render_body(context,error=,traceback=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    _____________________________ CmdTest.test_stdin_syntax_err ______________________________
    Traceback (most recent call last):
      File ".../mako/mako/cmd.py", line 51, in cmdline
        template = Template(sys.stdin.read(), lookup=lookup, output_encoding=output_encoding)
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 704, in _compile_text
        source, lexer = _compile(template, text, filename,
      File ".../mako/mako/template.py", line 685, in _compile
        node = lexer.parse()
      File ".../mako/mako/lexer.py", line 241, in parse
        if self.match_expression():
      File ".../mako/mako/lexer.py", line 393, in match_expression
        text, end = self.parse_until_text(True, r'\|', r'}')
      File ".../mako/mako/lexer.py", line 130, in parse_until_text
        raise exceptions.SyntaxException(
    mako.exceptions.SyntaxException: Expected: \|,} at line: 1 char: 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_cmd.py", line 26, in test_stdin_syntax_err
        cmdline(["--var", "x=5", "-"])
      File ".../mako/mako/cmd.py", line 53, in cmdline
        _exit()
      File ".../mako/mako/cmd.py", line 21, in _exit
        sys.stderr.write(exceptions.text_error_template().render())
      File ".../mako/mako/exceptions.py", line 236, in text_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc2d0910", line 19
        def render_body(context,error=,traceback=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    _______________________________ DefTest.test_def_py3k_args _______________________________
    Traceback (most recent call last):
      File ".../mako/test/test_def.py", line 50, in test_def_py3k_args
        template = Template("""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc2e34c0", line 19
        def kwonly(one,two,*three,four,five=,**six):
                                            ^
    SyntaxError: invalid syntax
    __________________________ NestedDefTest.test_nested_with_args ___________________________
    Traceback (most recent call last):
      File ".../mako/test/test_def.py", line 585, in test_nested_with_args
        t = Template("""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc2eddc0", line 34
        def b(x,y=):
                  ^
    SyntaxError: invalid syntax
    ____________________________ ExceptionsTest.test_custom_tback ____________________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 255, in test_custom_tback
        raise RuntimeError("error 2")
    RuntimeError: error 2
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 257, in test_custom_tback
        html_error = exceptions.html_error_template().\
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc2ed5e0", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    __________________________ ExceptionsTest.test_format_closures ___________________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 151, in test_format_closures
        foo()
    NameError: name 'foo' is not defined
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 153, in test_format_closures
        html_error = exceptions.html_error_template().render()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc4a52b0", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ___________________ ExceptionsTest.test_format_exceptions_no_pygments ____________________
    Traceback (most recent call last):
      File ".../mako/mako/runtime.py", line 892, in _exec_template
        callable_(context, *args, **kwargs)
      File "base_html", line 22, in render_body
      File "foo_html", line 34, in render_body
      File ".../mako/mako/runtime.py", line 226, in __str__
        raise NameError("Undefined")
    NameError: Undefined
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 205, in test_format_exceptions_no_pygments
        assert '<div class="sourceline">${foobar}</div>' in \
      File ".../mako/mako/template.py", line 467, in render_unicode
        return runtime._render(self,
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 894, in _exec_template
        _render_error(template, context, compat.exception_as())
      File ".../mako/mako/runtime.py", line 908, in _render_error
        error_template = exceptions.html_error_template()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc2e3220", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    _____________________ ExceptionsTest.test_format_exceptions_pygments _____________________
    Traceback (most recent call last):
      File ".../mako/mako/runtime.py", line 892, in _exec_template
        callable_(context, *args, **kwargs)
      File "base_html", line 22, in render_body
      File "foo_html", line 34, in render_body
      File ".../mako/mako/runtime.py", line 226, in __str__
        raise NameError("Undefined")
    NameError: Undefined
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 189, in test_format_exceptions_pygments
        assert '<div class="sourceline"><table class="syntax-highlightedtable">' in \
      File ".../mako/mako/template.py", line 467, in render_unicode
        return runtime._render(self,
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 894, in _exec_template
        _render_error(template, context, compat.exception_as())
      File ".../mako/mako/runtime.py", line 908, in _render_error
        error_template = exceptions.html_error_template()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc3597f0", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ________________________ ExceptionsTest.test_html_error_template _________________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 19, in test_html_error_template
        template = Template(code)
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 704, in _compile_text
        source, lexer = _compile(template, text, filename,
      File ".../mako/mako/template.py", line 685, in _compile
        node = lexer.parse()
      File ".../mako/mako/lexer.py", line 243, in parse
        if self.match_control_line():
      File ".../mako/mako/lexer.py", line 435, in match_control_line
        self.append_node(parsetree.ControlLine, keyword, isend, text)
      File ".../mako/mako/lexer.py", line 140, in append_node
        node = nodecls(*args, **kwargs)
      File ".../mako/mako/parsetree.py", line 83, in __init__
        code = ast.PythonFragment(text, **self.exception_kwargs)
      File ".../mako/mako/ast.py", line 85, in __init__
        raise exceptions.CompileException(
    mako.exceptions.CompileException: Fragment 'i = 0' is not a partial control statement at line: 2 char: 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 23, in test_html_error_template
        html_error = exceptions.html_error_template().render_unicode()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc33d640", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ________________ ExceptionsTest.test_py_unicode_error_html_error_template ________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 171, in test_py_unicode_error_html_error_template
        raise RuntimeError(u('日本'))
    RuntimeError: 日本
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 173, in test_py_unicode_error_html_error_template
        html_error = exceptions.html_error_template().render()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc338370", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ____________________ ExceptionsTest.test_py_utf8_html_error_template _____________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 159, in test_py_utf8_html_error_template
        raise RuntimeError('test')
    RuntimeError: test
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 161, in test_py_utf8_html_error_template
        html_error = exceptions.html_error_template().render()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc30c6d0", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ____________________ ExceptionsTest.test_tback_no_trace_from_py_file _____________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 276, in test_tback_no_trace_from_py_file
        html_error = exceptions.html_error_template().\
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc313970", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ______________________ ExceptionsTest.test_tback_trace_from_py_file ______________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 283, in test_tback_trace_from_py_file
        t.render()
      File ".../mako/mako/template.py", line 462, in render
        return runtime._render(self, self.callable_, args, data)
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 899, in _exec_template
        callable_(context, *args, **kwargs)
      File ".../mako/test/templates/modules/runtimeerr.html.py", line 22, in render_body
        print(y)
    UnboundLocalError: local variable 'y' referenced before assignment
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 286, in test_tback_trace_from_py_file
        html_error = exceptions.html_error_template().\
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc30cdf0", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ________________________ ExceptionsTest.test_text_error_template _________________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 48, in test_text_error_template
        template = Template(code)
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 704, in _compile_text
        source, lexer = _compile(template, text, filename,
      File ".../mako/mako/template.py", line 685, in _compile
        node = lexer.parse()
      File ".../mako/mako/lexer.py", line 243, in parse
        if self.match_control_line():
      File ".../mako/mako/lexer.py", line 435, in match_control_line
        self.append_node(parsetree.ControlLine, keyword, isend, text)
      File ".../mako/mako/lexer.py", line 140, in append_node
        node = nodecls(*args, **kwargs)
      File ".../mako/mako/parsetree.py", line 83, in __init__
        code = ast.PythonFragment(text, **self.exception_kwargs)
      File ".../mako/mako/ast.py", line 85, in __init__
        raise exceptions.CompileException(
    mako.exceptions.CompileException: Fragment 'i = 0' is not a partial control statement at line: 2 char: 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 52, in test_text_error_template
        text_error = exceptions.text_error_template().render_unicode()
      File ".../mako/mako/exceptions.py", line 236, in text_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc313b80", line 19
        def render_body(context,error=,traceback=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    _________________ ExceptionsTest.test_utf8_format_exceptions_no_pygments _________________
    Traceback (most recent call last):
      File ".../mako/mako/runtime.py", line 892, in _exec_template
        callable_(context, *args, **kwargs)
      File "foo_html", line 21, in render_body
    TypeError: can only concatenate str (not "Undefined") to str
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 239, in test_utf8_format_exceptions_no_pygments
        assert '<div class="sourceline">${&#39;привет&#39; + foobar}</div>'\
      File ".../mako/mako/template.py", line 462, in render
        return runtime._render(self, self.callable_, args, data)
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 894, in _exec_template
        _render_error(template, context, compat.exception_as())
      File ".../mako/mako/runtime.py", line 908, in _render_error
        error_template = exceptions.html_error_template()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc3135b0", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    __________________ ExceptionsTest.test_utf8_format_exceptions_pygments ___________________
    Traceback (most recent call last):
      File ".../mako/mako/runtime.py", line 892, in _exec_template
        callable_(context, *args, **kwargs)
      File "foo_html", line 21, in render_body
    TypeError: can only concatenate str (not "Undefined") to str
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 220, in test_utf8_format_exceptions_pygments
        assert '&#39;привет&#39;</span>' in \
      File ".../mako/mako/template.py", line 462, in render
        return runtime._render(self, self.callable_, args, data)
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 894, in _exec_template
        _render_error(template, context, compat.exception_as())
      File ".../mako/mako/runtime.py", line 908, in _render_error
        error_template = exceptions.html_error_template()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc4a52b0", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    ________________ ExceptionsTest.test_utf8_html_error_template_no_pygments ________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 121, in test_utf8_html_error_template_no_pygments
        template = Template(code)
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 704, in _compile_text
        source, lexer = _compile(template, text, filename,
      File ".../mako/mako/template.py", line 685, in _compile
        node = lexer.parse()
      File ".../mako/mako/lexer.py", line 243, in parse
        if self.match_control_line():
      File ".../mako/mako/lexer.py", line 435, in match_control_line
        self.append_node(parsetree.ControlLine, keyword, isend, text)
      File ".../mako/mako/lexer.py", line 140, in append_node
        node = nodecls(*args, **kwargs)
      File ".../mako/mako/parsetree.py", line 83, in __init__
        code = ast.PythonFragment(text, **self.exception_kwargs)
      File ".../mako/mako/ast.py", line 85, in __init__
        raise exceptions.CompileException(
    mako.exceptions.CompileException: Fragment 'if 2 == 2: /an error' is not a partial control statement at line: 2 char: 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 124, in test_utf8_html_error_template_no_pygments
        html_error = exceptions.html_error_template().render()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc2c1040", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    _________________ ExceptionsTest.test_utf8_html_error_template_pygments __________________
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 75, in test_utf8_html_error_template_pygments
        template = Template(code)
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 704, in _compile_text
        source, lexer = _compile(template, text, filename,
      File ".../mako/mako/template.py", line 685, in _compile
        node = lexer.parse()
      File ".../mako/mako/lexer.py", line 243, in parse
        if self.match_control_line():
      File ".../mako/mako/lexer.py", line 435, in match_control_line
        self.append_node(parsetree.ControlLine, keyword, isend, text)
      File ".../mako/mako/lexer.py", line 140, in append_node
        node = nodecls(*args, **kwargs)
      File ".../mako/mako/parsetree.py", line 83, in __init__
        code = ast.PythonFragment(text, **self.exception_kwargs)
      File ".../mako/mako/ast.py", line 85, in __init__
        raise exceptions.CompileException(
    mako.exceptions.CompileException: Fragment 'if 2 == 2: /an error' is not a partial control statement at line: 2 char: 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_exceptions.py", line 78, in test_utf8_html_error_template_pygments
        html_error = exceptions.html_error_template().render()
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc2eda90", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    _____________________________ InheritanceTest.test_pageargs ______________________________
    Traceback (most recent call last):
      File ".../mako/test/test_inheritance.py", line 199, in test_pageargs
        collection.put_string("index", """
      File ".../mako/mako/lookup.py", line 357, in put_string
        self._collection[uri] = Template(
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "index", line 26
        def render_body(context,x,y,z=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    ____________________________ InheritanceTest.test_pageargs_2 _____________________________
    Traceback (most recent call last):
      File ".../mako/test/test_inheritance.py", line 236, in test_pageargs_2
        collection.put_string("index", """
      File ".../mako/mako/lookup.py", line 357, in put_string
        self._collection[uri] = Template(
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "index", line 26
        def render_body(context,x,y,z=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    ___________________________ InheritanceTest.test_pageargs_err ____________________________
    Traceback (most recent call last):
      File ".../mako/test/test_inheritance.py", line 254, in test_pageargs_err
        collection.put_string("index", """
      File ".../mako/mako/lookup.py", line 357, in put_string
        self._collection[uri] = Template(
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "index", line 26
        def render_body(context,x,y,z=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    __________________________________ LexerTest.test_crlf ___________________________________
    Traceback (most recent call last):
      File ".../mako/test/test_lexer.py", line 820, in test_crlf
        assert flatten_result(Template(template).render()) \
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc3531f0", line 15
        def render_body(context,a=[, ],**pageargs):
                                   ^
    SyntaxError: invalid syntax
    __________________________ EncodingTest.test_escapes_html_tags ___________________________
    Traceback (most recent call last):
      File ".../mako/test/test_template.py", line 36, in test_escapes_html_tags
        x.render()
      File ".../mako/mako/template.py", line 462, in render
        return runtime._render(self, self.callable_, args, data)
      File ".../mako/mako/runtime.py", line 837, in _render
        _render_context(template, callable_, context, *args,
      File ".../mako/mako/runtime.py", line 873, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File ".../mako/mako/runtime.py", line 899, in _exec_template
        callable_(context, *args, **kwargs)
      File "memory:0x7fbfbc33d700", line 22, in render_body
    Exception: <span style="color:red">Foobar</span>
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_template.py", line 39, in test_escapes_html_tags
        markup = html_error_template().render(full=False, css=False)
      File ".../mako/mako/exceptions.py", line 290, in html_error_template
        return mako.template.Template(r"""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc33dd60", line 20
        def render_body(context,full=,css=,error=,traceback=,**pageargs):
                                     ^
    SyntaxError: invalid syntax
    _________________________ EncodingTest.test_unicode_file_lookup __________________________
    Traceback (most recent call last):
      File ".../mako/mako/lookup.py", line 247, in get_template
        return self._check(uri, self._collection[uri])
    KeyError: '/chs_unicode_py3k.html'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File ".../mako/test/test_template.py", line 92, in test_unicode_file_lookup
        template = lookup.get_template('/chs_unicode_py3k.html')
      File ".../mako/mako/lookup.py", line 258, in get_template
        return self._load(srcfile, uri)
      File ".../mako/mako/lookup.py", line 318, in _load
        self._collection[uri] = template = Template(
      File ".../mako/mako/template.py", line 338, in __init__
        module = self._compile_from_file(path, filename)
      File ".../mako/mako/template.py", line 413, in _compile_from_file
        code, module = _compile_text(
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "_chs_unicode_py3k_html", line 19
        def welcome(who,place=):
                              ^
    SyntaxError: invalid syntax
    ________________________ EncodingTest.test_unicode_literal_in_def ________________________
    Traceback (most recent call last):
      File ".../mako/test/test_template.py", line 257, in test_unicode_literal_in_def
        self._do_memory_test(
      File ".../mako/test/__init__.py", line 47, in _do_memory_test
        t1 = Template(text=source, **kw)
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc33d280", line 19
        def hello(foo=,bar=):
                      ^
    SyntaxError: invalid syntax
    ________________________________ PageArgsTest.test_basic _________________________________
    Traceback (most recent call last):
      File ".../mako/test/test_template.py", line 426, in test_basic
        template = Template("""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc4780a0", line 15
        def render_body(context,x,y,z=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    ___________ PageArgsTest.test_builtin_names_dont_clobber_defaults_in_includes ____________
    Traceback (most recent call last):
      File ".../mako/test/test_template.py", line 526, in test_builtin_names_dont_clobber_defaults_in_includes
        lookup.put_string("test1.mako", """
      File ".../mako/mako/lookup.py", line 357, in put_string
        self._collection[uri] = Template(
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "test1_mako", line 15
        def render_body(context,id=,**pageargs):
                                   ^
    SyntaxError: invalid syntax
    _____________________________ PageArgsTest.test_with_context _____________________________
    Traceback (most recent call last):
      File ".../mako/test/test_template.py", line 494, in test_with_context
        template = Template("""
      File ".../mako/mako/template.py", line 320, in __init__
        (code, module) = _compile_text(self, text, filename)
      File ".../mako/mako/template.py", line 711, in _compile_text
        code = compile(source, cid, 'exec')
      File "memory:0x7fbfbc3122b0", line 15
        def render_body(context,x,y,z=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    ==================================== warnings summary ====================================
    .tox/py38/lib/python3.8/site-packages/babel/localedata.py:17
      .../mako/.tox/py38/lib/python3.8/site-packages/babel/localedata.py:17: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
        from collections import MutableMapping
    
    -- Docs: https://docs.pytest.org/en/latest/warnings.html
    ================================ short test summary info =================================
    FAILED test/test_ast.py::AstParseTest::test_argument_list
    FAILED test/test_ast.py::AstParseTest::test_expr_generate
    FAILED test/test_cache.py::CacheTest::test_dynamic_key_with_funcargs
    FAILED test/test_cache.py::BeakerCacheTest::test_dynamic_key_with_funcargs
    FAILED test/test_cache.py::DogpileCacheTest::test_dynamic_key_with_funcargs
    FAILED test/test_cmd.py::CmdTest::test_file_rt_err
    FAILED test/test_cmd.py::CmdTest::test_file_syntax_err
    FAILED test/test_cmd.py::CmdTest::test_stdin_rt_err
    FAILED test/test_cmd.py::CmdTest::test_stdin_syntax_err
    FAILED test/test_def.py::DefTest::test_def_py3k_args
    FAILED test/test_def.py::NestedDefTest::test_nested_with_args
    FAILED test/test_exceptions.py::ExceptionsTest::test_custom_tback
    FAILED test/test_exceptions.py::ExceptionsTest::test_format_closures
    FAILED test/test_exceptions.py::ExceptionsTest::test_format_exceptions_no_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_format_exceptions_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_html_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_py_unicode_error_html_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_py_utf8_html_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_tback_no_trace_from_py_file
    FAILED test/test_exceptions.py::ExceptionsTest::test_tback_trace_from_py_file
    FAILED test/test_exceptions.py::ExceptionsTest::test_text_error_template
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_format_exceptions_no_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_format_exceptions_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_html_error_template_no_pygments
    FAILED test/test_exceptions.py::ExceptionsTest::test_utf8_html_error_template_pygments
    FAILED test/test_inheritance.py::InheritanceTest::test_pageargs
    FAILED test/test_inheritance.py::InheritanceTest::test_pageargs_2
    FAILED test/test_inheritance.py::InheritanceTest::test_pageargs_err
    FAILED test/test_lexer.py::LexerTest::test_crlf
    FAILED test/test_template.py::EncodingTest::test_escapes_html_tags
    FAILED test/test_template.py::EncodingTest::test_unicode_file_lookup
    FAILED test/test_template.py::EncodingTest::test_unicode_literal_in_def
    FAILED test/test_template.py::PageArgsTest::test_basic
    FAILED test/test_template.py::PageArgsTest::test_builtin_names_dont_clobber_defaults_in_includes
    FAILED test/test_template.py::PageArgsTest::test_with_context
    ============= 35 failed, 424 passed, 5 skipped, 1 warnings in 11.02 seconds ==============
    ERROR: InvocationError for command '.../mako/.tox/py38/bin/py.test' (exited with code 1)
    ________________________________________ summary _________________________________________
    ERROR:   py38: commands failed
    

    Most of the failures are some kind of SyntaxError:

        def render_body(context,error=,traceback=,**pageargs):
                                      ^
    SyntaxError: invalid syntax
    
        def kwonly(one,two,*three,four,five=,**six):
                                            ^
    SyntaxError: invalid syntax
    
        def b(x,y=):
                  ^
    SyntaxError: invalid syntax
    

    Seems like some values are missing in the rendered code, but I really have no idea.

    opened by hroncok 21
  • Refactoring Code

    Refactoring Code

    Setup.py

    • Use with when opening file to ensure closure

    Util.py

    • Remove unnecessary else after guard condition
    • Replace if statement with if expression
    • Remove unnecessary else after guard condition
    • Replace unneeded comprehension with generator
    • Inline variable that is immediately returned

    Template.py

    • Replace if statement with if expression, Simplify if expression by using or
    • Replace list(), dict() or set() with comprehension
    • Swap if/else branches, Merge else clause's nested if statement into elif

    Runtime.py

    • Remove unnecessary else after guard condition

    PyParser.py

    • Replace yield inside for loop with yield from
    • Lift code into else after jump in control flow, Merge else clause's nested if statement into elif
    • Replace if statement with if expression

    Pygen.py

    • Merge nested if conditions
    • Simplify conditional into return statement (removes comment)
    • Replace if statement with if expression, Simplify boolean if expression

    Parsetree.py

    • Replace unneeded comprehension with generator
    • Merge else clause's nested if statement into elif
    • Replace unneeded comprehension with generator

    Lookup.py

    • Swap if/else branches, Merge else clause's nested if statement into elif
    • Swap if/else branches, Remove unnecessary else after guard condition

    Lexer.py

    • Replace if statement with if expression
    • Merge nested if conditions
    • Swap if/else branches, Remove unnecessary else after guard condition, Merge else clause's nested if statement into elif
    • Swap if/else branches, Remove unnecessary else after guard condition

    Exceptions.py

    • Replace if statement with if expression, Use with when opening file to ensure closure

    Ast.py

    • Replace multiple comparisons of same variable with in operator

    Pygmentplugin.py

    • Replace if statement with if expression
    opened by yezz123 20
  • Fix exception causes in lookup.py

    Fix exception causes in lookup.py

    I recently went over Matplotlib, Pandas and NumPy, fixing a small mistake in the way that Python 3's exception chaining is used. If you're interested, I can do it here too. I've done it on just one file right now.

    The mistake is this: In some parts of the code, an exception is being caught and replaced with a more user-friendly error. In these cases the syntax raise new_error from old_error needs to be used.

    Python 3's exception chaining means it shows not only the traceback of the current exception, but that of the original exception (and possibly more.) This is regardless of raise from. The usage of raise from tells Python to put a more accurate message between the tracebacks. Instead of this:

    During handling of the above exception, another exception occurred:
    

    You'll get this:

    The above exception was the direct cause of the following exception:
    

    The first is inaccurate, because it signifies a bug in the exception-handling code itself, which is a separate situation than wrapping an exception.

    Let me know what you think!

    opened by cool-RR 18
  • Syntax error with ${{'foo':'bar'}}

    Syntax error with ${{'foo':'bar'}}

    Migrated issue, originally created by Anonymous

    This works fine:

    <li>${dict(method="get")}</li>
    

    This crashes:

    <li>${{'method':'get'}}</li>
    

    mako.exceptions.SyntaxException: (SyntaxError) unexpected EOF while parsing (line 1) ("{'method':'get'") in file [...]


    Attachments: mako_braces.diff | mako_ticket20.diff | mako-lexer-fix.diff

    bug low priority compiler 
    opened by sqlalchemy-bot 14
  • allow usage of non-ascii bytestring literals in templates

    allow usage of non-ascii bytestring literals in templates

    Migrated issue, originally created by Anonymous

    The mako template parser has a problem, or a weirdness, depending on your view. Basically it is not possible to compile any template that contains non-ascii characters inside the ${} code. The problem traces back to python's built-in compiler inability to compile out-of-ascii unicode source. To fix it some kind of encoding-juggling inside ast.py (the 'parse' function?) would be needed as well as adding a #-*- prefix to the code being compiled there. Alas, I haven't been able to fix this myself (mysterious body snatcher exceptions pop out) neither have I enough time to work on it but I'm sure you get the idea.

    To replicate the problem, just compile "${f('\u0142')}" as a mako template.

    I should add that the problem is serious, at least for us and a showstopper for mako adoption in our project.


    Attachments: alternate_unicode.patch

    low priority feature compiler 
    opened by sqlalchemy-bot 14
  • turn off unicode

    turn off unicode

    Migrated issue, originally created by Anonymous

    if the input and output are not uincode, then decode and encode cause some overhead, add a choice to turn unicode off could improve the performance a bit.

    add a argument in Lookup and Template: ... ,using_unicode = True, ...

    when turn off unicode, the compiled module source is saved with the proper charset, and adding

    # -*- encoding:charset -*-
    

    in head, escape is not needed.


    Attachments: unicode.patch

    low priority feature compiler 
    opened by sqlalchemy-bot 13
  • Instrument iterables ala jinja ?

    Instrument iterables ala jinja ?

    Migrated issue, originally created by Michael Bayer (@zzzeek)

    i.e. user does this:

    % for x in collection:
        % if lastelement:
        % endif
    % endif
    

    we see the magic name "lastelement". We then compile to this:

    % for lastelement, x in __M_marklast(collection):
        % if lastelement:
        % endif
    % endif
    

    easy !

    tentative 0.3 feature. May come out.


    Attachments: loop_instrumentation.patch | loop_instrumentation.2.patch | 125.patch

    low priority feature compiler 
    opened by sqlalchemy-bot 12
  • Use unittest.SkipTest (again?)

    Use unittest.SkipTest (again?)

    While I can believe that the standard exception might not have worked with some ancient version of pytest, it certainly works just fine now. This saves people from importing nose which kills pytest via DeprecationWarnings these days.

    opened by mgorny 11
  • Mako should declare what extra dependencies are required for the custom gettext message extractors

    Mako should declare what extra dependencies are required for the custom gettext message extractors

    Mako provides gettext message extractors for lingua and Babel. They are declared as setuptools entry points. Such entry points can and should specify a list of 'extras': third-party dependencies that should be installed in order to use these custom entry points.

    See for example issue wichert/lingua#94: lingua has the capability to use custom message extractors for both lingua and Babel. Now, if Mako and lingua are installed but Babel is not, then lingua blindly loads Mako's custom message extractors for Babel and fails while trying to use them since Babel is not installed. To help lingua (and potentially other tools as well) to recognize that Babel should be installed in order to use the custom Mako-for-Babel message extractor, Mako should declare Babel as an extra dependency of the entry point for the message extractor.

    See the setuptools documentation on "Dynamic Discovery of Services and Plugins" for details.

    installation 
    opened by sinoroc 11
  • Exception rewrite causes wrong template name reported.

    Exception rewrite causes wrong template name reported.

    Migrated issue, originally created by Stanislav Tsybulka (@enomad)

    I know it's a very weird use case. Although it can be fixed by not caching (the way I do in this example) here. it works when ‘raise KeyError’ added

    from mako.lookup import TemplateLookup
    from mako import exceptions
    
    lookup = TemplateLookup()
    lookup.put_string("1.mako",
    """
    <%namespace name="testtest" file="2.mako" />
    
    ${ testtest.run(self, gogogo) }
    
    <%namespace name='some_template'>
      
      <%def name="some_def()">
      	${ 1/0 }
      </%def>
    
    </%namespace>
    
    """)
    
    lookup.put_string("2.mako",
    """
    
    <%def name='run(caller_template, callback_fn)'>
    	${ callback_fn(context, caller_template) }
    </%def>
    """)
    
    def gogogo(context, caller_template):
    	namespace = caller_template.module._mako_get_namespace(context, 'some_template')
    	def_callable = namespace.callables.get('some_def')
    	return def_callable()
    
    
    try:
        print lookup.get_template("1.mako").render(gogogo = gogogo)
    except:
        print(exceptions.text_error_template().render())
    

    without the 'fix':

      File "1_mako", line 4, in render_body
        ${ testtest.run(self, gogogo) }
      File "2_mako", line 4, in render_run
        ${ callback_fn(context, caller_template) }
      File "test_exception.py", line 34, in gogogo
        return def_callable()
      File "2_mako", line 9, in some_def
        ${ 1/0 }
    ZeroDivisionError: integer division or modulo by zero
    

    with:

      File "1_mako", line 4, in render_body
        ${ testtest.run(self, gogogo) }
      File "2_mako", line 4, in render_run
        ${ callback_fn(context, caller_template) }
      File "test_exception.py", line 34, in gogogo
        return def_callable()
      File "1_mako", line 9, in some_def
        ${ 1/0 }
    ZeroDivisionError: integer division or modulo by zero
    
    
    bug compiler 
    opened by sqlalchemy-bot 11
  • Run mako templates as standalone executables

    Run mako templates as standalone executables

    That way, mako can directly evaluate template files and can be used as a file interpreter.

    When using either

    • #!/usr/bin/env -S python3 -m mako -s -a --
    • #!/usr/bin/env -S mako-render -s -a -- as shebang, a file can be templated directly, and behaves similar to a PHP script. With this commit, Python can be run as PyHP :)

    This is possible because -s or --strip-shebang strips away the shebang line in the input template. Program arguments get modified so you can even run ./awesome.mako --my-argument test --rolf

    -a shifts the template argv - the sys.argv is replaced by the cmdline args to the template execution. It can then use regular argparse for parsing further arguments.

    One can use this new feature to dynamically generate static config files, for example. Or generate arbitary files when using something like execfs.

    So this could be a simple example for an executable test.mako file:

    #!/usr/bin/mako-render -s --
    This is awesome!
    <%
    # hehe like pyhp :)
    import argparse
    cli = argparse.ArgumentParser()
    cli.add_argument("stuff")
    # argparsing also works as expected for an executable:
    args = cli.parse_args()
    %>
    stuff: ${args.stuff}
    

    run as

    $ ./test.mako yay
    This is awesome!
    
    stuff: yay
    
    opened by TheJJ 11
  • Using `.pre-commit-config` as a linter and test link check

    Using `.pre-commit-config` as a linter and test link check

    I guess pre-commit is a good suggestion to let the project clean, and also check the new PRs if they correspond to the linting rules.

    For example:

    • I use https://github.com/pre-commit/pre-commit-hooks for checking:
    hooks:
              - id: check-merge-conflict
              - id: check-added-large-files
              - id: check-ast
              - id: check-symlinks
              - id: trailing-whitespace
              - id: check-json
              - id: debug-statements
              - id: pretty-format-json
    
    • For sorting imports, I use https://github.com/PyCQA/isort with the black profile.
    • I use https://gitlab.com/pycqa/flake8 also for applying all style rules.

    I will try to describe this issue in a PR.

    opened by yezz123 1
  • on render, encoding issues do not show which line caused the Exception

    on render, encoding issues do not show which line caused the Exception

    If a template is opened with incompatible encoding (such as unicode text but no UTF-8 identification on PY2, or potential encoding mismatches on PY3), a Unicode error will be raised that notes the offending character position but no line is identified.

    A potential way to address this is to return a mako.exceptions.RuntimeException that includes the debug information and the original exception.

    see https://github.com/sqlalchemy/mako/blob/master/mako/util.py#L169

    opened by jvanasco 1
  • Persistence of *.html.py file in temporary directory

    Persistence of *.html.py file in temporary directory

    Environment Linux, Mageia 7 x86_64 Mako assumes incorrectly that if a .html.py file exists in the specified temporary directory: tmpl = Template(filename='weather.html', module_directory='/tmp/mako_modules') that the template does not need to be re-compiled. I have been testing a development version of a python script alongside the production version, with a slight difference in the template. Mako just uses whichever version was last compiled.

    opened by ggemmill 1
  • %% not working when not at the beginning of the line

    %% not working when not at the beginning of the line

    Hello,

    Thanks for developing and maintaining a great package.

    I have a template that looks like this

    # -*- coding: utf-8 -*-
    %%pip install package
    if <some condition>:
        %%pip install <some other package>
    

    This gets rendered into

    # -*- coding: utf-8 -*-
    %pip install package
    if <some condition>:
        %%pip install <some other package>
    

    where the last line starts with (some spaces) + %%

    Trying to template

    # -*- coding: utf-8 -*-
    %%pip install package
    if <some condition>:
        %pip install <some other package>
    

    Raises Thanks again

    opened by pjadzinsky 3
Releases(rel_1_2_4)
  • rel_1_2_4(Nov 15, 2022)

    1.2.4

    Released: Tue Nov 15 2022

    bug

    • [bug] [codegen] Fixed issue where unpacking nested tuples in a for loop using would raise a "couldn't apply loop context" error if the loop context was used. The regex used to match the for loop expression now allows the list of loop variables to contain parenthesized sub-tuples. Pull request courtesy Matt Trescott.

      References: #368

    Source code(tar.gz)
    Source code(zip)
  • rel_1_2_3(Sep 22, 2022)

    1.2.3

    Released: Thu Sep 22 2022

    bug

    • [bug] [lexer] Fixed issue in lexer in the same category as that of #366 where the regexp used to match an end tag didn't correctly organize for matching characters surrounded by whitespace, leading to high memory / interpreter hang if a closing tag incorrectly had a large amount of unterminated space in it. Credit to Sebastian Chnelik for locating the issue.

      As Mako templates inherently render and directly invoke arbitrary Python code from the template source, it is never appropriate to create templates that contain untrusted input.

      References: #367

    Source code(tar.gz)
    Source code(zip)
  • rel_1_2_2(Aug 29, 2022)

    1.2.2

    Released: Mon Aug 29 2022

    bug

    • [bug] [lexer] Fixed issue in lexer where the regexp used to match tags would not correctly interpret quoted sections individually. While this parsing issue still produced the same expected tag structure later on, the mis-handling of quoted sections was also subject to a regexp crash if a tag had a large number of quotes within its quoted sections.

      References: #366

    Source code(tar.gz)
    Source code(zip)
  • rel_1_2_1(Jun 30, 2022)

    1.2.1

    Released: Thu Jun 30 2022

    bug

    • [bug] [tests] Various fixes to the test suite in the area of exception message rendering to accommodate for variability in Python versions as well as Pygments.

      References: #360

    misc

    • [performance] Optimized some codepaths within the lexer/Python code generation process, improving performance for generation of templates prior to their being cached. Pull request courtesy Takuto Ikuta.

      References: #361

    Source code(tar.gz)
    Source code(zip)
  • rel_1_2_0(Mar 10, 2022)

    1.2.0

    Released: Thu Mar 10 2022

    changed

    • [changed] [py3k] Corrected "universal wheel" directive in setup.cfg so that building a wheel does not target Python 2.

      References: #351

    • [changed] [py3k] The bytestring_passthrough template argument is removed, as this flag only applied to Python 2.

    • [changed] [py3k] With the removal of Python 2's cStringIO, Mako now uses its own internal FastEncodingBuffer exclusively.

    • [changed] [py3k] Removed disable_unicode flag, that's no longer used in Python 3.

    • [changed] Refactored test utilities into mako.testing module. Removed unittest.TestCase dependency in favor of pytest.

      References: #349

    • [changed] [setup] Replaced the use of pkg_resources with the importlib library. For Python < 3.8 the library importlib_metadata is used.

    • [changed] [py3k] Removed support for Python 2 and Python 3.6. Mako now requires Python >= 3.7.

    bug

    • [bug] [py3k] Mako now performs exception chaining using raise from, correctly identifying underlying exception conditions when it raises its own exceptions. Pull request courtesy Ram Rachum.
    Source code(tar.gz)
    Source code(zip)
  • rel_1_1_6(Nov 17, 2021)

    1.1.6

    Released: Wed Nov 17 2021

    bug

    • [bug] [lexer] Fixed issue where control statements on multi lines with a backslash would not parse correctly if the template itself contained CR/LF pairs as on Windows. Pull request courtesy Charles Pigott.

      References: #346

    Source code(tar.gz)
    Source code(zip)
  • rel_1_1_5(Aug 20, 2021)

    1.1.5

    Released: Fri Aug 20 2021

    bug

    • [bug] [tests] Fixed some issues with running the test suite which would be revealed by running tests in random order.

      References: #338

    Source code(tar.gz)
    Source code(zip)
  • rel_1_1_4(Jan 14, 2021)

    1.1.4

    Released: Thu Jan 14 2021

    bug

    • [bug] [py3k] Fixed Python deprecation issues related to module importing, as well as file access within the Lingua plugin, for deprecated APIs that began to emit warnings under Python 3.10. Pull request courtesy Petr Viktorin.

      References: #328

    Source code(tar.gz)
    Source code(zip)
  • rel_1_1_3(May 29, 2020)

    1.1.3

    Released: Fri May 29 2020

    bug

    • [bug] [templates] The default template encoding is now utf-8. Previously, the encoding was "ascii", which was standard throughout Python 2. This allows that "magic encoding comment" for utf-8 templates is no longer required.

      References: #267

    Source code(tar.gz)
    Source code(zip)
  • rel_1_1_2(Mar 2, 2020)

    1.1.2

    Released: Sun Mar 1 2020

    feature

    • [feature] [commands] Added --output-file argument to the Mako command line runner, which allows a specific output file to be selected. Pull request courtesy Björn Dahlgren.

      References: #283

    Source code(tar.gz)
    Source code(zip)
  • rel_1_1_1(Jan 20, 2020)

    1.1.1

    Released: Mon Jan 20 2020

    bug

    • [bug] [py3k] Replaced usage of the long-superseded "parser.suite" module in the mako.util package for parsing the python magic encoding comment with the "ast.parse" function introduced many years ago in Python 2.5, as "parser.suite" is emitting deprecation warnings in Python 3.9.

      References: #310

    • [bug] [ext] Added "babel" and "lingua" dependency entries to the setuptools entrypoints for the babel and lingua extensions, so that pkg_resources can check that these extra dependencies are available, raising an informative exception if not. Pull request courtesy sinoroc.

      References: #304

    Source code(tar.gz)
    Source code(zip)
  • rel_1_1_0(Sep 2, 2019)

    1.1.0

    Released: Thu Aug 1 2019

    • [bug] [py3k] [windows] Replaced usage of time.clock() on windows as well as time.time() elsewhere for microsecond timestamps with timeit.default_timer(), as time.clock() is being removed in Python 3.8. Pull request courtesy Christoph Reiter.

      References: #301

    • [bug] [py3k] Replaced usage of inspect.getfullargspec() with the vendored version used by SQLAlchemy, Alembic to avoid future deprecation warnings. Also cleans up an additional version of the same function that's apparently been floating around for some time.

      References: #295

    • [changed] [setup] Removed the "python setup.py test" feature in favor of a straight run of "tox". Per Pypa / pytest developers, "setup.py" commands are in general headed towards deprecation in favor of tox. The tox.ini script has been updated such that running "tox" with no arguments will perform a single run of the test suite against the default installed Python interpreter.

      References: #303

    • [changed] [installer] [py3k] Mako 1.1 now supports Python versions:

      -   2.7
      
      -   3.4 and higher
      

      This includes that setup.py no longer includes any conditionals, allowing for a pure Python wheel build, however this is not necessarily part of the Pypi release process as of yet. The test suite also raises for Python deprecation warnings.

      References: #249

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_14(Sep 2, 2019)

    1.0.14

    Released: Sat Jul 20 2019

    • [feature] [template] The n filter is now supported in the <%page> tag. This allows a template to omit the default expression filters throughout a whole template, for those cases where a template-wide filter needs to have default filtering disabled. Pull request courtesy Martin von Gagern.

    • [bug] [exceptions] Fixed issue where the correct file URI would not be shown in the template-formatted exception traceback if the template filename were not known. Additionally fixes an issue where stale filenames would be displayed if a stack trace alternated between different templates. Pull request courtesy Martin von Gagern.

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_13(Sep 2, 2019)

    1.0.13

    Released: Mon Jul 1 2019

    • [bug] [exceptions] Improved the line-number tracking for source lines inside of Python <% ... %> blocks, such that text- and HTML-formatted exception traces such as that of html_error_template() now report the correct source line inside the block, rather than the first line of the block itself. Exceptions in <%! ... %> blocks which get raised while loading the module are still not reported correctly, as these are handled before the Mako code is generated. Pull request courtesy Martin von Gagern.
    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_12(Sep 2, 2019)

  • rel_1_0_11(Sep 2, 2019)

    1.0.11

    Released: Fri May 31 2019

    • [changed] Updated for additional project metadata in setup.py. Additionally, the code has been reformatted using Black and zimports.
    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_10(Sep 2, 2019)

    1.0.10

    Released: Fri May 10 2019

    • [bug] [py3k] Added a default encoding of "utf-8" when the RichTraceback object retrieves Python source lines from a Python traceback; as these are bytes in Python 3 they need to be decoded so that they can be formatted in the template.

      References: #293

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_9(Sep 2, 2019)

    1.0.9

    Released: Mon Apr 15 2019

    • [bug] Further corrected the previous fix for #287 as it relied upon an attribute that is monkeypatched by Python's ast module for some reason, which fails if ast hasn't been imported; the correct attribute Constant.value is now used. Also note the issue was mis-numbered in the previous changelog note.

      References: #287

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_8(Sep 2, 2019)

    1.0.8

    Released: Wed Mar 20 2019

    • [bug] Fixed an element in the AST Python generator which changed for Python 3.8, causing expression generation to fail.

      References: #287

    • [feature] Added --output-encoding flag to the mako-render script. Pull request courtesy lacsaP.

      References: #271

    • [bug] Removed unnecessary "usage" prefix from mako-render script. Pull request courtesy Hugo.

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_7(Sep 2, 2019)

    1.0.7

    Released: Thu Jul 13 2017

    • [bug] Changed the "print" in the mako-render command to sys.stdout.write(), avoiding the extra newline at the end of the template output. Pull request courtesy Yves Chevallier.
    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_6(Sep 2, 2019)

    1.0.6

    Released: Wed Nov 9 2016

    • [feature] Added new parameter Template.include_error_handler . This works like Template.error_handler but indicates the handler should take place when this template is included within another template via the <%include> tag. Pull request courtesy Huayi Zhang.
    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_5(Sep 2, 2019)

  • rel_1_0_4(Sep 2, 2019)

    1.0.4

    Released: Thu Mar 10 2016

    • [feature] [test] The default test runner is now py.test. Running "python setup.py test" will make use of py.test instead of nose. nose still works as a test runner as well, however.

    • [bug] [lexer] Major improvements to lexing of intricate Python sections which may contain complex backslash sequences, as well as support for the bitwise operator (e.g. pipe symbol) inside of expression sections distinct from the Mako "filter" operator, provided the operator is enclosed within parentheses or brackets. Pull request courtesy Daniel Martin.

      References: pull request github:19

    • [feature] Added new method Template.list_defs(). Pull request courtesy Jonathan Vanasco.

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_3(Sep 2, 2019)

    1.0.3

    Released: Tue Oct 27 2015

    • [babel] [bug] Fixed an issue where the Babel plugin would not handle a translation symbol that contained non-ascii characters. Pull request courtesy Roman Imankulov.
    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_2(Sep 2, 2019)

    1.0.2

    Released: Wed Aug 26 2015

    • [bug] [installation] The "universal wheel" marker is removed from setup.cfg, because our setup.py currently makes use of conditional dependencies. In #249, the discussion is ongoing on how to correct our setup.cfg / setup.py fully so that we can handle the per-version dependency changes while still maintaining optimal wheel settings, so this issue is not yet fully resolved.

      References: #249

    • [bug] [py3k] Repair some calls within the ast module that no longer work on Python3.5; additionally replace the use of inspect.getargspec() under Python 3 (seems to be called from the TG plugin) to avoid deprecation warnings.

      References: #250

    • [bug] Update the Lingua translation extraction plugin to correctly handle templates mixing Python control statements (such as if, for and while) with template fragments. Pull request courtesy Laurent Daverio.

    • [feature] Added STOP_RENDERING keyword for returning/exiting from a template early, which is a synonym for an empty string "". Previously, the docs suggested a bare return, but this could cause None to appear in the rendered template result.

      References: #236

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_1(Sep 2, 2019)

    1.0.1

    Released: Thu Jan 22 2015

    • [feature] Added support for Lingua, a translation extraction system as an alternative to Babel. Pull request courtesy Wichert Akkerman.

    • [bug] [py3k] Modernized the examples/wsgi/run_wsgi.py file for Py3k. Pull requset courtesy Cody Taylor.

    Source code(tar.gz)
    Source code(zip)
  • rel_1_0_0(Sep 2, 2019)

    1.0.0

    Released: Sun Jun 8 2014

    • [bug] [py2k] Improved the error re-raise operation when a custom Template.error_handler is used that does not handle the exception; the original stack trace etc. is now preserved. Pull request courtesy Manfred Haltner.

    • [bug] [filters] [py2k] Added an html_escape filter that works in "non unicode" mode. Previously, when using disable_unicode=True, the u filter would fail to handle non-ASCII bytes properly. Pull request courtesy George Xie.

    • [general] Compatibility changes; in order to modernize the codebase, Mako is now dropping support for Python 2.4 and Python 2.5 altogether. The source base is now targeted at Python 2.6 and forwards.

    • [feature] Template modules now generate a JSON "metadata" structure at the bottom of the source file which includes parseable information about the templates' source file, encoding etc. as well as a mapping of module source lines to template lines, thus replacing the "# SOURCE LINE" markers throughout the source code. The structure also indicates those lines that are explicitly not part of the template's source; the goal here is to allow better integration with coverage and other tools.

    • [bug] [py3k] Fixed bug in decode.<encoding> filter where a non-string object would not be correctly interpreted in Python 3.

    • [bug] [py3k] Fixed bug in Python parsing logic which would fail on Python 3 when a "try/except" targeted a tuple of exception types, rather than a single exception.

      References: #227

    • [feature] mako-render is now implemented as a setuptools entrypoint script; a standalone mako.cmd.cmdline() callable is now available, and the system also uses argparse now instead of optparse. Pull request courtesy Derek Harland.

    • [feature] The mako-render script will now catch exceptions and run them into the text error handler, and exit with a non-zero exit code. Pull request courtesy Derek Harland.

    • [bug] A rework of the mako-render script allows the script to run correctly when given a file pathname that is outside of the current directory, e.g. mako-render ../some_template.mako. In this case, the "template root" defaults to the directory in which the template is located, instead of ".". The script also accepts a new argument --template-dir which can be specified multiple times to establish template lookup directories. Standard input for templates also works now too. Pull request courtesy Derek Harland.

    • [feature] [py3k] Support is added for Python 3 "keyword only" arguments, as used in defs. Pull request courtesy Eevee.

      References: pull request github:7

    Source code(tar.gz)
    Source code(zip)
  • rel_0_9_1(Sep 2, 2019)

    0.9.1

    Released: Thu Dec 26 2013

    • [bug] Fixed bug in Babel plugin where translator comments would be lost if intervening text nodes were encountered. Fix courtesy Ned Batchelder.

      References: #225

    • [bug] Fixed TGPlugin.render method to support unicode template names in Py2K - courtesy Vladimir Magamedov.

    • [bug] Fixed an AST issue that was preventing correct operation under alpha versions of Python 3.4. Pullreq courtesy Zer0-.

    • [bug] Changed the format of the "source encoding" header output by the code generator to use the format # -*- coding:%s -*- instead of # -*- encoding:%s -*-; the former is more common and compatible with emacs. Courtesy Martin Geisler.

    • [bug] Fixed issue where an old lexer rule prevented a template line which looked like "#*" from being correctly parsed.

      References: #224

    Source code(tar.gz)
    Source code(zip)
  • rel_0_9_0(Sep 2, 2019)

    0.9.0

    Released: Tue Aug 27 2013

    • [bug] The Context.locals_() method becomes a private underscored method, as this method has a specific internal use. The purpose of Context.kwargs has been clarified, in that it only delivers top level keyword arguments originally passed to template.render().

      References: #219

    • [bug] Fixed the babel plugin to properly interpret ${} sections inside of a "call" tag, i.e. <%self:some_tag attr="${_('foo')}"/>. Code that's subject to babel escapes in here needs to be specified as a Python expression, not a literal. This change is backwards incompatible vs. code that is relying upon a _('') translation to be working within a call tag.

    • [bug] The Babel plugin has been repaired to work on Python 3.

      References: #187

    • [bug] Using <%namespace import="*" module="somemodule"/> now skips over module elements that are not explcitly callable, avoiding TypeError when trying to produce partials.

      References: #207

    • [bug] Fixed Py3K bug where a "lambda" expression was not interpreted correctly within a template tag; also fixed in Py2.4.

      References: #190

    Source code(tar.gz)
    Source code(zip)
  • rel_0_8_1(Sep 2, 2019)

    0.8.1

    Released: Fri May 24 2013

    • [bug] Changed setup.py to skip installing markupsafe if Python version is < 2.6 or is between 3.0 and less than 3.3, as Markupsafe now only supports 2.6->2.X, 3.3->3.X.

      References: #216

    • [bug] Fixed regression where "entity" filter wasn't converted for py3k properly (added tests.)

      References: #214

    • [bug] Fixed bug where mako-render script wasn't compatible with Py3k.

      References: #212

    • [bug] Cleaned up all the various deprecation/ file warnings when running the tests under various Pythons with warnings turned on.

      References: #213

    Source code(tar.gz)
    Source code(zip)
Owner
SQLAlchemy
The Database Toolkit and Object Relational Mapper
SQLAlchemy
✈️ HTML Template engine for python. Supports XSS preventation and many more!

Htmotor HTML Template Engine for Python! Installation: Open your terminal and type pip install htmotor.

Penguen 3 Nov 6, 2022
A simple, elegant Python based web templating engine (part of web.py).

Templator Simple, elegant Python based web templating (part of web.py). If you are familiar with Python, there is no new syntax to learn. This is a st

Dan 1 Dec 13, 2021
Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

null 3 Oct 25, 2022
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.6k Dec 30, 2022
Tweak the form field rendering in templates, not in python-level form definitions. CSS classes and HTML attributes can be altered.

django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is su

Jazzband 1.8k Jan 2, 2023
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.6k Jan 2, 2023
Static site generator for designers. Uses Python and Django templates.

News Cactus 3 is out! We're happy to announce Cactus 3. It brings a set of great new features like asset fingerprinting, an asset pipeline, pretty url

null 3.4k Jan 1, 2023
Tweak the form field rendering in templates, not in python-level form definitions. CSS classes and HTML attributes can be altered.

django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is su

Jazzband 1.8k Jan 6, 2023
Simple reuse of partial HTML page templates in the Jinja template language for Python web frameworks.

Jinja Partials Simple reuse of partial HTML page templates in the Jinja template language for Python web frameworks. (There is also a Pyramid/Chameleo

Michael Kennedy 106 Dec 28, 2022
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.7k Jan 8, 2023
PyPC is a very simple tool that creates Python projects from templates.

PyPC (Python Project Creator) PyPC is a very simple tool that creates Python projects from templates. In 0.1v#alpha, custom template creation will be

art3m1s 1 Nov 26, 2021
Library and command-line utility for rendering projects templates.

A library for rendering project templates. Works with local paths and git URLs. Your project can include any file and Copier can dynamically replace v

null 808 Jan 4, 2023
Formatting of dates and times in Flask templates using moment.js.

Flask-Moment This extension enhances Jinja2 templates with formatting of dates and times using moment.js. Quick Start Step 1: Initialize the extension

Miguel Grinberg 358 Nov 28, 2022
A flask template with Bootstrap 4, asset bundling+minification with webpack, starter templates, and registration/authentication. For use with cookiecutter.

cookiecutter-flask A Flask template for cookiecutter. (Supports Python ≥ 3.6) See this repo for an example project generated from the most recent vers

null 4.3k Dec 29, 2022
Full control of form rendering in the templates.

django-floppyforms Full control of form rendering in the templates. Authors: Gregor Müllegger and many many contributors Original creator: Bruno Renié

Jazzband 811 Dec 1, 2022
Formatting of dates and times in Flask templates using moment.js.

Flask-Moment This extension enhances Jinja2 templates with formatting of dates and times using moment.js. Quick Start Step 1: Initialize the extension

Miguel Grinberg 318 Feb 17, 2021
Implementation of "Deep Implicit Templates for 3D Shape Representation"

Deep Implicit Templates for 3D Shape Representation Zerong Zheng, Tao Yu, Qionghai Dai, Yebin Liu. arXiv 2020. This repository is an implementation fo

Zerong Zheng 144 Dec 7, 2022
NetBox plugin that stores configuration diffs and checks templates compliance

Config Officer - NetBox plugin NetBox plugin that deals with Cisco device configuration (collects running config from Cisco devices, indicates config

null 77 Dec 21, 2022
Use heroicons in your Django and Jinja templates.

heroicons Use heroicons in your Django and Jinja templates. Requirements Python 3.6 to 3.9 supported. Django 2.2 to 3.2 supported. Are your tests slow

Adam Johnson 52 Dec 14, 2022
Formatting of dates and times in Flask templates using moment.js.

Flask-Moment This extension enhances Jinja2 templates with formatting of dates and times using moment.js. Quick Start Step 1: Initialize the extension

Miguel Grinberg 358 Nov 28, 2022