[Checkins] SVN: megrok.chameleon/trunk/src/megrok/chameleon/expressions.py Nasty workaround when z3c.pt is installed at the same time: we skip

Uli Fouquet uli at gnufix.de
Wed Mar 3 09:03:37 EST 2010


Log message for revision 109609:
  Nasty workaround when z3c.pt is installed at the same time: we skip
  registering of IExpressionTranslator utilities in order not to clash
  with z3c.pt registrations.
  

Changed:
  U   megrok.chameleon/trunk/src/megrok/chameleon/expressions.py

-=-
Modified: megrok.chameleon/trunk/src/megrok/chameleon/expressions.py
===================================================================
--- megrok.chameleon/trunk/src/megrok/chameleon/expressions.py	2010-03-03 12:22:46 UTC (rev 109608)
+++ megrok.chameleon/trunk/src/megrok/chameleon/expressions.py	2010-03-03 14:03:36 UTC (rev 109609)
@@ -294,6 +294,19 @@
 path_translator = PathTranslator()
 provider_translator = ProviderTranslator()
 
-grok.global_utility(ExistsTranslator, name='exists')
-grok.global_utility(PathTranslator, name='path')
-grok.global_utility(ProviderTranslator, name='provider')
+z3c_pt_installed = True
+try:
+    import z3c.pt
+except ImportError:
+    z3c_pt_installed = False
+    
+if not z3c_pt_installed:
+    #XXX: Nasty workaround when z3c.pt is installed
+    #
+    # As z3c.pt registers same sort of translators for same interfaces
+    # and under same name (Chameleon needs it to parse certain TALES
+    # expressions), we do only conditionally register these utilites
+    # here.
+    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