[Zope-Checkins] SVN: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/ added

Andreas Jung andreas at andreas-jung.com
Sat Jan 6 13:57:30 EST 2007


Log message for revision 71749:
  added
  

Changed:
  A   Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml
  U   Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py
  A   Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py

-=-
Added: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml
===================================================================
--- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml	2007-01-06 18:22:34 UTC (rev 71748)
+++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml	2007-01-06 18:57:30 UTC (rev 71749)
@@ -0,0 +1,11 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:browser="http://namespaces.zope.org/browser"
+           xmlns:five="http://namespaces.zope.org/five">
+
+
+  <utility
+      provides="zope.component.interfaces.IFactory"
+      component="Products.PageTemplates.unicodeconflictresolver.UnicodeEncodingResolverFactory"
+      />
+
+</configure>

Modified: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py
===================================================================
--- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py	2007-01-06 18:22:34 UTC (rev 71748)
+++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py	2007-01-06 18:57:30 UTC (rev 71749)
@@ -4,7 +4,7 @@
 
 class IUnicodeEncodingConflictResolver(Interface):
 
-    class resolve(context, text):
+    def resolve(context, text):
         """ Returns 'text' as unicode string. 
             'context' is the current context object
         """

Added: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py
===================================================================
--- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py	2007-01-06 18:22:34 UTC (rev 71748)
+++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py	2007-01-06 18:57:30 UTC (rev 71749)
@@ -0,0 +1,37 @@
+###########################################################################
+# TextIndexNG V 3                
+# The next generation TextIndex for Zope
+#
+# This software is governed by a license. See
+# LICENSE.txt for the terms of this license.
+###########################################################################
+
+
+
+from zope.component.interfaces import IFactory
+from zope.interface import implements, implementedBy
+
+from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver
+
+class UnicodeEncodingResolver:
+
+    implements(IUnicodeEncodingConflictResolver)
+
+    def __init__(self, context, text):
+        self.context = context
+        self.text = text
+
+    def resolve(self, context, text):
+        return unicode(self.text, errors='replace')
+
+class UnicodeEncodingResolverFactory:
+    
+    implements(IFactory)
+
+    def __call__(self, context, text):
+        return UnicodeEncodingResolver(context, text)
+
+    def getInterfaces(self):
+        return implementedBy(UnicodeEncodingResolverFactory)
+
+UnicodeEncodingResolverFactory = UnicodeEncodingResolverFactory() 



More information about the Zope-Checkins mailing list