Commit a558fa87 authored by Andreas Jung's avatar Andreas Jung

added

parent 61832080
<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>
...@@ -4,7 +4,7 @@ from zope.interface import Interface ...@@ -4,7 +4,7 @@ from zope.interface import Interface
class IUnicodeEncodingConflictResolver(Interface): class IUnicodeEncodingConflictResolver(Interface):
class resolve(context, text): def resolve(context, text):
""" Returns 'text' as unicode string. """ Returns 'text' as unicode string.
'context' is the current context object 'context' is the current context object
""" """
......
###########################################################################
# 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()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment