Age | Commit message (Collapse) | Author |
|
|
|
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.
Fixes: #283
Change-Id: Iae7e2d42d5ae4bc6f09663c115bda9e3797ce68c
Pull-request: https://bitbucket.org/zzzeek/mako/pull-requests/27
|
|
|
|
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.
Additionally repair two error-detection unit tests that were using a
"print" statement despite the tests running under Python 3; while the
tests were passing they were no longer testing the right thing.
Fixes: #310
Change-Id: Id436e2c6620438ef16b3f188b989233c82972b29
|
|
also fix one flake8 error
Change-Id: Ia828267fce34d5b194898e3e301b6d463470f068
|
|
|
|
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.
Fixes: #249
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.
Fixes: #295
Change-Id: I98274c16b6022289d1890f4daf532bab323ab112
|
|
|
|
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.
Fixes: #301
Closes: #302
Pull-request: https://github.com/sqlalchemy/mako/pull/302
Pull-request-sha: a706e952727337702692fd1d8369d259e1600d6e
Change-Id: I24e2cd3d2c02323a6fa2b063e86cabe555df2036
|
|
We want to bump Python versions so add a major release bump.
Change-Id: I4b21d3782c701e4b21c5ef53c0a19eee8d2d7a40
|
|
|
|
|
|
In some situations, it is inconvenient to pass default_filters in the
Template constructor depending on the template in question. It might be
easier in such situations to express page filters in the template itself.
However, dropping the existing default_filters (either explicitly set or the
default of ["str"] resp. ["unicode"]) might break existing templates.
The code change here comes to the rescue in such situations. Existing
templates keep working as they are, but editors of templates get a tool to
replace the default filters for specific templates. They do take on the
responsibility of turning all encountered inputs into strings, lest they
fail along the lines of https://github.com/sqlalchemy/mako/issues/272.
This change should be sufficiently backwards compatible to not cause any
concerns. Sure, technically a "n" filter at page tag level was treated as a
no-op so far. So theoretically existing templates could break. But there
was no incentive to have such an "n" filter at the page tag level, and the
expressed semantics of the "n" filter is to suppress default filters, so
semantically anyone relying on it being a no-op in that situation was using
unsupported hacks anyway.
Closes: #299
Pull-request: https://github.com/sqlalchemy/mako/pull/299
Pull-request-sha: f8d5a22db3230634d2b42c59909985f31875a9f5
Change-Id: Ide030975229c1df7c0cef534976f740a03c17ca6
|
|
Using URIs as entrered will make the stack trace arguably more readable than
using the module name which is the URI with non-word characters replaced by
underscores.
This change also fixes a mistake where a mods cache hit would not update
template_filename, causing a stale filename to be displayed if the stack
trace alternates between different templates. There now is a test case for
this.
Closes: #298
Pull-request: https://github.com/sqlalchemy/mako/pull/298
Pull-request-sha: ea35208d504932561711cdb574ec1f7def1e7060
Change-Id: Ieb606f6b6b7f4602d4d56694dd0bccf6dc287d20
|
|
|
|
Improved the line-number tracking for source lines inside of Python ``<%
... %>`` blocks, such that text- and HTML-formatted exception traces such
as that of :func:`.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.
Closes: #297
Pull-request: https://github.com/sqlalchemy/mako/pull/297
Pull-request-sha: 60ad749604f8de0a9b8133430995045a93d0939c
Change-Id: I2086e4370e8e2db7099de01743840286f0160efc
|
|
|
|
As this is an old module that keeps changing with new Python
releases, combined with the fact that we no longer use "import *",
remove all unused functions from this module so that the list
of imports we are maintaining is much shorter.
Python 3.8 is also added to tox.ini with more adjustments to
test_exceptions to accommodate for quoting differences.
Fixes: #296
Change-Id: I0cea7d21ecb2be9335e0845ae7fbd06d468a137b
|
|
|
|
Change-Id: I258e9ff77e5a9ac687cd20d33b6d75de7c79b4dc
|
|
Change-Id: Ia047c7052a6d242c2cf1c7a83981f1e38ea4d928
|
|
|
|
Added a default encoding of "utf-8" when the :class:`.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.
Fixes: #293
Change-Id: I41a5c09422d6500c7cab2423ed14ac951a64e2f4
|
|
|
|
Since Python 3.8, class ast.Constant is used for all constants.
Old classes ast.Num, ast.Str, ast.Bytes, ast.NameConstant and
ast.Ellipsis are still available, but they will be removed in
future Python releases.
Further corrected the previous fix for :ticket:`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: https://github.com/Pylons/pyramid_mako/issues/47
Fixes: #287
Closes: #292
Pull-request: https://github.com/sqlalchemy/mako/pull/292
Pull-request-sha: b48081aa08fdc1cb6e0196b59a2d0eff35adcd94
Change-Id: Ic3fd1975e608b6890410f3fd4ad4d949478dc45e
|
|
|
|
Python 3.8 seems to require this be present for expression
generation to succeed.
Fixes: #287
Change-Id: I4a3ac22c74e3c96f5f15d349fc8fe2523d6e7def
|
|
Includes PR https://github.com/zzzeek/mako/pull/26 so [Travis CI passes](https://travis-ci.org/hugovk/mako/builds/329346809). The last two commits are unique to this PR.
---
Since Mako 1.0.0, Python 2.6 has been the minimum supported version:
> [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.
http://docs.makotemplates.org/en/latest/changelog.html#change-b602a175c0ec26eaa4f42962d23cca96
This removes redundant code only relevant to Python 2.5 or earlier.
It also adds `python_requires` to setup.py, so pip won't install this version on Python 2.5 or earlier. For people with older versions, pip will install the next Mako version down.
Are all Python 3.x versions supported? If not, I'll add those to `python_requires` as well.
Change-Id: I624e1d56e79555c579278c7a5b4de9498179ffe9
Pull-request: https://github.com/zzzeek/mako/pull/27
|
|
Pull request courtesy Hugo.
(cherry picked from commit 7e6a1d7822bac275aabb3c1cc90cb67612548127)
Change-Id: I84a302c982f18762d2514c3f840331d1eb3ebcda
|
|
Fixes: #271
Change-Id: I88b46cfbdea9eda0b4c478dd97829bee8431ff58
|
|
The `print` function adds an unwanted `\n` char.
Change-Id: I4e345214352f0925c374145f41be45550da27393
Pull-request: https://github.com/zzzeek/mako/pull/23
|
|
Change-Id: Ic586955b3faf41632da794792ecc9ae447a4051e
|
|
|
|
|
|
on Python 3.6+
|
|
This works like error_handler but is specific to a template
when included in another using the include tag.
Change-Id: Ie5506a8cba42c71519c703eacc82050902b9ceba
Pull-request: https://bitbucket.org/zzzeek/mako/pull-requests/22
|
|
Change-Id: Ib357002b0c919ce532c9b67ba40fcee91ba2554c
|
|
in 161b1cf57a3777922fd3e05a6e1314386c2a3912
|
|
|
|
|
|
|
|
|
|
pr16
|
|
|
|
This allows the lexer to correctly handle strings like:
${'backslash quote right-curly is \\\'}'}
And also allows users to use the bitwise-or operator to mean bitwise or
simply by enclosing the expression inside parens:
${(0x5432 | 0x8000)}
or by using it in the middle of a dictionary literal:
${ {'foo-val': 0x43 | 0x100, 'bar-val': 0x22 | 0x100}[thing+'-val']}
or inside brackets:
${ big_lookup_dict[index_low | (indexhigh << 3)] }
Basically, only "top level" uses of the vertical bar mean pipe.
(Note that currently, any non-top-level use of the vertical bar in
an expression just results in a syntax error in the generated python,
so no working code is affected by this change)
|
|
|
|
If mako templates contain something like "_('Köln')", babel extractor converts
it to pure ASCII so that resulting .po file would contain "K\xf6ln". Not all
translation tools and translations are ready for such kind of escape sequences.
Babel allows message ids to be non-ascii, the plugin just has to return Unicode
objects instead of ASCII strings (and that's exactly how Babel built-in Python
and JavaScript extractors work).
This fix ensures mako extractor doesn't excape non-ascii symbols, works well
both for Unicode and non-unicode input (there is a test for cp1251 encoding),
and also provides a workaround for babel charset detector python-babel/babel#274.
|
|
- posixpath.join does not handle windows paths very well.
Now all tests pass on py27 & py34 on windows.
|
|
additionally replace the use of ``inspect.getargspec()`` under
Python 3 (seems to be called from the TG plugin) to avoid deprecation
warnings.
fixes #250
|
|
spaces inside curly brackets.
|