Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

A tool to rewrite parts of template files (DTML, ZPT).

License

Notifications You must be signed in to change notification settings

gocept/gocept.template_rewrite

Repository files navigation

gocept.template_rewrite

Caution

This is package is archived as gocept does not maintain it anymore. If you are interested in working with it, please contact mail@gocept.com or the contributors to get the respective permissions.

image

image

image

image

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.10.

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.