Registry / web-framework / zope-tal

zope-tal

JSON →
library6.0pypypiunverified

zope.tal provides an implementation of the Zope Template Application Language (TAL), a powerful and secure server-side templating system primarily used within the Zope framework but usable standalone. It enforces strict separation of presentation logic from application logic. The current stable version is 6.0, with releases typically tied to Python version support updates and Zope ecosystem advancements.

pip install zope.tal
INSTALL
IMPORT
SIG · ZOPE-TAL
Z
zope-tal
web-frameworkpythonv6.0
Install
2.3s avg
Import
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 21.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.3s · import 0.000s · 22MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TALTemplate
from zope.tal.template import TALTemplate
from zope.tal.template import TALTemplate

This quickstart demonstrates how to define a TAL template, create a Python object to serve as the template context, and render the template using `TALTemplate`.

from zope.tal.template import TALTemplate # Define a simple TAL template template_string = ''' <html tal:define="user_name context/name"> <head> <title tal:content="context/page_title">Default Title</title> </head> <body> <h1 tal:content="string:Hello, ${user_name}!" /> <p tal:condition="context/is_admin">Welcome, Administrator!</p> <ul tal:repeat="item context/items"> <li tal:content="item" /> </ul> </body> </html> ''' # Create a context object with data for the template class MyContext: def __init__(self, name, title, admin_status, item_list): self.name = name self.page_title = title self.is_admin = admin_status self.items = item_list # Instantiate the template template = TALTemplate(template_string) # Create a context instance context_data = MyContext( name='Alice', title='My TAL Page', admin_status=True, item_list=['Item 1', 'Item 2', 'Item 3'] ) # Render the template with the context output = template(context_data) print(output)
Debug
Known issues
breakingPython 3.8 and older are no longer supported by `zope.tal` version 6.x.
fix
Ensure your project uses Python 3.9 or newer. Upgrade your Python environment if necessary.
affects: 6.0+
breakingThe `zope.interface` dependency has been updated, requiring `zope.interface >= 6.0`.
fix
Upgrade `zope.interface` in your environment: `pip install 'zope.interface>=6.0'`.
affects: 6.0+
gotchaTAL templates are strict about XML/HTML well-formedness. Mismatched tags, unquoted attributes, or special characters not escaped can lead to parsing errors.
fix
Always ensure your TAL templates are valid XML/HTML. Use an HTML linter or validator if you encounter parsing issues.
affects: All
gotchaContext path expressions (e.g., `context/title`) are case-sensitive and require attributes/items to exist on the context object or its sub-objects. Non-existent paths will lead to `AttributeError` or `KeyError` during rendering.
fix
Carefully verify that all variables and paths referenced in your TAL template exist in the provided context object. Use `tal:condition` or `tal:default` to handle potentially missing values gracefully.
affects: All
Upgrade
Version history
6.0latest on PyPI · released Sep 12, 2025
Audit
Dependencies
zope.interfacerequiredCore dependency for Zope component architecture, required >= 6.0 for zope.tal 6.x.
setuptoolsrequiredBuild-time dependency, implicitly handled by pip.
Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
1
Resources
zope-tal — pip install zope-tal · libregistry