skillfed

DocumentTemplate

Document Templating Markup Language (DTML)

documenttemplate v5.3 136.8K downloads/30d#11,386 on PyPI7
License unclear ZPL-2.1 Active released

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 documenttemplate

uv

uv add documenttemplate

poetry

poetry add documenttemplate

Installing 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

Development Status :: 6 - MatureEnvironment :: Web EnvironmentFramework :: ZopeFramework :: Zope :: 5Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Text Processing :: Markup

Tags

DTML template enginezope document templatingSGML markup templatinglegacy zope templatesdtml variable replacementzope conditional templatinghtml template markup language
legacy-zopedtml-templatesrestricted-execution

More Markup packages