A tool to rewrite parts of template files (DTML, ZPT).
Project description
gocept.template_rewrite
A tool to rewrite parts of template files (DTML, ZPT and XPT).
The initial use case is to have a pluggable system to convert Python 2 expressions in templates to Python 3.
This package runs on Python 3.6 up to 3.8.
Requirements
For the rewrite to work properly, it is necessary to have this structure attr="value" for attributes in tags with no whitespaces around the =, as otherwise the values will get lost.
Caveats
During rewrite double hyphens within HTML-comments are removed as the Chameleon engine in Zope 4 (and the actual specification) is very strict about it.
The underlying lib2to3 does not take into account, that the cmp function is no longer available in Python 3.
This tool converts Python 2 to Python 3 - that means the code may not be compatible with Python 2 any more. For these edge cases manual changes are required to make it compatible with both versions.
Developing gocept.template_rewrite
- Author:
- Issues:
- Source code:
- Current change log:
https://raw.githubusercontent.com/gocept/gocept.template_rewrite/master/CHANGES.rst
- Installation:
pip3 install gocept.template_rewrite
- Run the tests:
$ tox
Change log for gocept.template_rewrite
1.0 (2020-04-07)
Print exact location of error in case of problems parsing Page Templates.
Add parameter –collect-errors that continues to parse all given files and prints all found parsing errors but exits with an error and does not replace any files if an error was found. This replaces the argument –only-show-errors present in earlier versions. This allows to create a full list of errors to be fixed before a rewrite is possible.
Add notes about more caveats.
File discovery now also includes TrustedFSPageTemplate files, which are registered with the file ending .xpt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gocept.template_rewrite-1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dbd8ad91f37001f65b04bf26da740d4c55fb2258c6142562d8485a9e0633284 |
|
MD5 | 591ae3d60b32546382e1c83088648dac |
|
BLAKE2b-256 | 008f073eca8cebd5c567d55253f4e7920b227ec9c16c647b93905812a8cdcb19 |
Hashes for gocept.template_rewrite-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cff2493be35dd878eaeda2cb51a4e7c71dc289585e9b802768be637cafbfc481 |
|
MD5 | 925d8be1ec20dfb7692c5d14c8b864f6 |
|
BLAKE2b-256 | ba33756f54a0208f5a3f749c28a16078260bfc09de7c1ddc727dc3a53795b56e |