[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/pagetemplate.py Special-case handling of Zope2's Missing.MV as used by

Ross Patterson me at rpatterson.net
Wed Nov 3 16:31:55 EDT 2010


Log message for revision 118199:
  Special-case handling of Zope2's Missing.MV as used by
  Products.ZCatalog for LP#649343.  Test coverage is in five.pt.  Put
  the fix here using a conditional import per Malthe's suggestion since
  there's no good place to put it in five.pt where it belongs.
  

Changed:
  U   z3c.pt/trunk/src/z3c/pt/pagetemplate.py

-=-
Modified: z3c.pt/trunk/src/z3c/pt/pagetemplate.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/pagetemplate.py	2010-11-03 16:41:38 UTC (rev 118198)
+++ z3c.pt/trunk/src/z3c/pt/pagetemplate.py	2010-11-03 20:31:55 UTC (rev 118199)
@@ -17,6 +17,12 @@
 
 from z3c.pt import language
 
+try:
+    from Missing import MV
+    MV  # pyflakes
+except ImportError:
+    MV = object()
+
 _marker = object()
 _expr_cache = {}
 
@@ -121,6 +127,11 @@
             # bind translation-method to request
             def translate(
                 msgid, domain=None, mapping=None, target_language=None, default=None):
+                if msgid is MV:
+                    # Special case handling of Zope2's Missing.MV
+                    # (Missing.Value) used by the ZCatalog but is
+                    # unhashable
+                    return
                 return fast_translate(
                     msgid, domain, mapping, request, target_language, default)
             context[config.SYMBOLS.translate] = translate



More information about the checkins mailing list