[Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate - TALES.py:1.5
Fred L. Drake, Jr.
fdrake@acm.org
Fri, 14 Jun 2002 17:14:20 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate
In directory cvs.zope.org:/tmp/cvs-serv23200/PageTemplate
Modified Files:
TALES.py
Log Message:
Add formal interfaces for the connections between TAL/METAL and TALES.
Add __implements__ "declarations" where appropriate.
=== Zope3/lib/python/Zope/PageTemplate/TALES.py 1.4 => 1.5 ===
from SafeMapping import SafeMapping
+from Zope.TAL.ITALES import ITALESCompiler, ITALESEngine, ITALESErrorInfo
+
NAME_RE = r"[a-zA-Z][a-zA-Z0-9_]*"
_parse_expr = re.compile(r"(%s):" % NAME_RE).match
@@ -69,6 +71,9 @@
class ErrorInfo:
"""Information about an exception passed to an on-error handler."""
+
+ __implements__ = ITALESErrorInfo
+
def __init__(self, err, position=(None, None)):
if isinstance(err, Exception):
self.type = err.__class__
@@ -89,6 +94,9 @@
these handlers. It can provide an expression Context, which is
capable of holding state and evaluating compiled expressions.
'''
+
+ __implements__ = ITALESCompiler
+
def __init__(self):
self.types = {}
self.base_names = {}
@@ -153,6 +161,8 @@
An instance of this class holds context information that it can
use to evaluate compiled expressions.
'''
+
+ __implements__ = ITALESEngine
_context_class = SafeMapping
position = (None, None)