[Checkins] SVN: z3ext.layout/trunk/ added expressiontype directive

Nikolay Kim fafhrd91 at gmail.com
Thu Jan 21 01:27:09 EST 2010


Log message for revision 108346:
  added expressiontype directive

Changed:
  U   z3ext.layout/trunk/CHANGES.txt
  U   z3ext.layout/trunk/setup.py
  U   z3ext.layout/trunk/src/z3ext/layout/configure.zcml
  U   z3ext.layout/trunk/src/z3ext/layout/meta.zcml
  U   z3ext.layout/trunk/src/z3ext/layout/zcml.py

-=-
Modified: z3ext.layout/trunk/CHANGES.txt
===================================================================
--- z3ext.layout/trunk/CHANGES.txt	2010-01-21 03:08:52 UTC (rev 108345)
+++ z3ext.layout/trunk/CHANGES.txt	2010-01-21 06:27:08 UTC (rev 108346)
@@ -13,7 +13,9 @@
 
 - Use ``ErrorReportingUtility`` for exception logging
 
+- Added ``z3ext:expressiontype`` directive
 
+
 2.2.2 (2009-09-14)
 ------------------
 

Modified: z3ext.layout/trunk/setup.py
===================================================================
--- z3ext.layout/trunk/setup.py	2010-01-21 03:08:52 UTC (rev 108345)
+++ z3ext.layout/trunk/setup.py	2010-01-21 06:27:08 UTC (rev 108346)
@@ -65,12 +65,10 @@
                           'zope.error',
                           'zope.browserpage',
                           'zope.app.schema',
-                          'zope.app.pagetemplate',
                           'z3c.pt',
                           ],
       extras_require = dict(test=['zope.container',
                                   'zope.app.testing',
-                                  'zope.app.pagetemplate',
                                   'zope.testing',
                                   'RestrictedPython',
                                   ]),

Modified: z3ext.layout/trunk/src/z3ext/layout/configure.zcml
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/configure.zcml	2010-01-21 03:08:52 UTC (rev 108345)
+++ z3ext.layout/trunk/src/z3ext/layout/configure.zcml	2010-01-21 06:27:08 UTC (rev 108346)
@@ -23,7 +23,7 @@
      factory=".expressions.PageletTranslator" />
 
   <!-- resourcepackage: tales expression -->
-  <tales:expressiontype
+  <z3ext:expressiontype
      name="pagelet"
      handler=".tales.TALESPageletExpression" />
 

Modified: z3ext.layout/trunk/src/z3ext/layout/meta.zcml
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/meta.zcml	2010-01-21 03:08:52 UTC (rev 108345)
+++ z3ext.layout/trunk/src/z3ext/layout/meta.zcml	2010-01-21 06:27:08 UTC (rev 108346)
@@ -17,6 +17,11 @@
        name="pageletType"
        schema=".zcml.IPageletTypeDirective"
        handler=".zcml.pageletTypeDirective" />
+
+    <meta:directive
+       name="expressiontype"
+       schema=".zcml.IExpressionTypeDirective"
+       handler=".zcml.expressiontype" />
   </meta:directives>
 
 </configure>

Modified: z3ext.layout/trunk/src/z3ext/layout/zcml.py
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/zcml.py	2010-01-21 03:08:52 UTC (rev 108345)
+++ z3ext.layout/trunk/src/z3ext/layout/zcml.py	2010-01-21 06:27:08 UTC (rev 108346)
@@ -31,6 +31,7 @@
 from zope.publisher.interfaces.browser import IBrowserPublisher
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.component.zcml import IBasicViewInformation
+from zope.browserpage.metaconfigure import registerType
 
 from z3c.pt.pagetemplate import ViewPageTemplateFile
 
@@ -189,6 +190,30 @@
 ILayoutDirective.setTaggedValue('keyword_arguments', True)
 
 
+# ExpressionType
+class IExpressionTypeDirective(interface.Interface):
+    """Register a new TALES expression type"""
+
+    name = schema.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)
+
+
+def expressiontype(_context, name, handler):
+    _context.action(
+        discriminator = ("tales:expressiontype", name),
+        callable = registerType,
+        args = (name, handler))
+
+
 def pageletTypeDirective(_context, name, interface):
     if interface is not IPagelet and interface.isOrExtends(IPublishTraverse):
         raise ConfigurationError("Can't use IPublishTraverse as base for pagelet type")



More information about the checkins mailing list