[Checkins] SVN: megrok.chameleon/branches/ulif-z3c.pt-less/src/megrok/chameleon/expressions.py Register the TALES translators using grok.
Uli Fouquet
uli at gnufix.de
Mon Mar 1 20:22:15 EST 2010
Log message for revision 109549:
Register the TALES translators using grok.
We now have a working Chameleon engine that still supports ``path``,
``exists`` and ``provider`` without ``z3c.pt``, but only as regular
TALES expressions, i.e. as ``tal:content="exists: varname"`` and not
as Python expressions any more
(``tal:content="exists('varname')"``). As this is neighter supported
by z3c.pt anymore, there might be not much loss.
In the long run we might try to get rid of ``path`` and ``exists``
anyway, as they are expression types one usually needs when no
appropriate Python expression is available or it is too cumbersome to
write down the ``python:`` prefix all the time (which is not necessary
with megrok.chameleon).
Changed:
U megrok.chameleon/branches/ulif-z3c.pt-less/src/megrok/chameleon/expressions.py
-=-
Modified: megrok.chameleon/branches/ulif-z3c.pt-less/src/megrok/chameleon/expressions.py
===================================================================
--- megrok.chameleon/branches/ulif-z3c.pt-less/src/megrok/chameleon/expressions.py 2010-03-02 01:02:44 UTC (rev 109548)
+++ megrok.chameleon/branches/ulif-z3c.pt-less/src/megrok/chameleon/expressions.py 2010-03-02 01:22:15 UTC (rev 109549)
@@ -1,3 +1,4 @@
+import grokcore.component as grok
import re
import namespaces
import zope.event
@@ -207,9 +208,13 @@
return value
-class NotTranslator(expressions.ExpressionTranslator):
- zope.component.adapts(IExpressionTranslator)
+class NotTranslator(expressions.ExpressionTranslator, grok.Adapter):
+ #zope.component.adapts(IExpressionTranslator)
+ grok.name('not')
+ grok.context(IExpressionTranslator)
+ grok.provides(IExpressionTranslator)
+
recursive = True
def __init__(self, translator):
@@ -289,3 +294,7 @@
exists_translator = ExistsTranslator()
path_translator = PathTranslator()
provider_translator = ProviderTranslator()
+
+grok.global_utility(ExistsTranslator, name='exists')
+grok.global_utility(PathTranslator, name='path')
+grok.global_utility(ProviderTranslator, name='provider')
More information about the checkins
mailing list