[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate - meta.zcml:1.3 metaconfigure.py:1.5 metadirectives.py:1.2

Philipp von Weitershausen philikon at philikon.de
Wed Mar 3 21:10:40 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/pagetemplate
In directory cvs.zope.org:/tmp/cvs-serv21790

Modified Files:
	meta.zcml metaconfigure.py metadirectives.py 
Log Message:
Added new ZCML directive for registering expression types.


=== Zope3/src/zope/app/pagetemplate/meta.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/pagetemplate/meta.zcml:1.2	Sun Aug  3 16:43:35 2003
+++ Zope3/src/zope/app/pagetemplate/meta.zcml	Wed Mar  3 21:10:09 2004
@@ -10,6 +10,11 @@
         handler=".metaconfigure.namespace"
         />
 
+    <meta:directive name="expressiontype"
+        schema=".metadirectives.IExpressionTypeDirective"
+        handler=".metaconfigure.expressiontype"
+        />
+
   </meta:directives>
 
 </configure>


=== Zope3/src/zope/app/pagetemplate/metaconfigure.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/pagetemplate/metaconfigure.py:1.4	Tue Sep 16 18:04:17 2003
+++ Zope3/src/zope/app/pagetemplate/metaconfigure.py	Wed Mar  3 21:10:09 2004
@@ -27,4 +27,18 @@
         args = (prefix, lambda ob: getAdapter(ob, interface)),
         )
 
+def expressiontype(_context, name, handler):
+    _context.action(
+        discriminator = ("tales:expressiontype", name),
+        callable = Engine.registerType,
+        args = (name, handler)
+        )
+
+
+def clearExprTypes():
+    import zope.app.pagetemplate.engine
+    from zope.app.pagetemplate.engine import _Engine
+    zope.app.pagetemplate.engine.Engine = _Engine()
+
 addCleanUp(Engine.namespaces.clear)
+addCleanUp(clearExprTypes)


=== Zope3/src/zope/app/pagetemplate/metadirectives.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/pagetemplate/metadirectives.py:1.1	Sun Aug  3 16:43:35 2003
+++ Zope3/src/zope/app/pagetemplate/metadirectives.py	Wed Mar  3 21:10:09 2004
@@ -46,3 +46,20 @@
         interface.""",
         required=True
         )
+
+class IExpressionTypeDirective(Interface):
+    """Register a new TALES expression type"""
+
+    name = TextLine(
+        title=u"Name",
+        description=u"""Name of the expression. This will also be used
+        as the prefix in actual TALES expressions.""",
+        required=True
+        )
+
+    handler = GlobalObject(
+        title=u"Handler",
+        description=u"""Handler is class that implements
+        zope.tales.interfaces.ITALESExpression.""",
+        required=True
+        )




More information about the Zope3-Checkins mailing list