DocumentTemplate
Document Templating Markup Language (DTML)
What it is and what it does
DocumentTemplate is a legacy templating system from the Zope framework that processes DTML (Document Templating Markup Language)—a custom SGML-based markup for embedding dynamic content in HTML and SQL templates. It provides variable substitution, conditional blocks, loops, and other programmatic features through custom tags like `<dtml-var>`, `<dtml-if>`, and `<dtml-in>`.
The package is now primarily maintained for backward compatibility with existing Zope applications. Modern Zope environments have largely moved to TAL (Template Attribute Language) and page templates for new development. It depends on Zope security and object-access infrastructure (AccessControl, Acquisition, RestrictedPython) and integrates with zope.sequencesort for sorting operations. The implementation is pure Python as of version 3.0, with no compiled dependencies.
Use it for:
- Maintaining or extending legacy Zope applications that use DTML templates for dynamic page generation.
- Rendering HTML or SQL templates with variable substitution and conditional logic in Zope-based systems.
- Processing DTML documents that require restricted execution contexts for security-sensitive applications.
- Migrating or refactoring older Zope codebases while preserving existing DTML template functionality.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
DocumentTemplate implements the Document Templating Markup Language (DTML), a legacy template system using custom SGML tags for variable replacement, conditional logic, and loops in Zope environments.
Yes, but only if you are maintaining or extending an existing Zope application that uses DTML. Do not install for new projects—use modern templating systems instead. The package is actively maintained, has no known vulnerabilities, and installs with low friction. License treatment is unclear; verify ZPL-2.1 compliance for your use case before deployment.
Install
documenttemplate on PyPI
pip
pip install documenttemplateuv
uv add documenttemplatepoetry
poetry add documenttemplateInstalling DocumentTemplate
Before you install
Low friction installation with a pure-Python implementation and no compiled dependencies. Actively maintained with recent releases; last commit on 2026-02-25. Requires Python 3.10 or later.
License in practice
Licensed under ZPL-2.1 (Zope Public License 2.1), though license treatment is marked unclear in the metadata. Verify compliance requirements before use in proprietary or commercial projects.
Quickstart
pip install DocumentTemplate
from DocumentTemplate import HTML
template = HTML('<dtml-var name>')
result = template(name='Hello')
Requires Python 3.10 or later. Designed primarily for Zope environments; standalone use outside Zope may require additional setup for full functionality.
Verify before relying
- Whether DTML templates can be safely used with untrusted input given the RestrictedPython dependency and its security model.
- Current adoption rate and whether new projects should use DTML or migrate to modern Zope templating (TAL/page templates).
- Specific performance characteristics compared to modern template engines.
Package facts
| License | ZPL-2.1 (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — AccessControl, Acquisition, ExtensionClass, RestrictedPython, roman, zExceptions, zope.sequencesort, zope.structuredtext |
| Maintenance | actively maintained — 170 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 136,830/month — #11,386 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: documenttemplate-5.3-py3-none-any.whl
Keywords: DTML, template, zope, HTML, SQL, web, markup
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
empyEmPy is a templating system that embeds Python…
permissive · top 15,000 on PyPI
zope.pagetemplatezope.pagetemplate provides a templating system…
unclear · top 15,000 on PyPI
zope.talzope.tal implements the Template Attribute…
unclear · top 15,000 on PyPI
pomlPOML is a markup language and Python SDK for…
unclear · top 15,000 on PyPI
zope.taleszope.tales provides an expression language for…
unclear · top 15,000 on PyPI
sgmllib3kA Python 3 port of the deprecated stdlib…
permissive · top 5,000 on PyPI
zope.configurationZope.configuration provides an extensible…
unclear · top 5,000 on PyPI
zope.structuredtextParses and renders Zope structured text (STX),…
unclear · top 15,000 on PyPI
zope.contentproviderProvides a framework for building componentized…
unclear · top 15,000 on PyPI
ZConfigZConfig is a schema-driven configuration…
unclear · top 15,000 on PyPI