[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG - TextIndexNG.py:1.2.2.48 ConverterRegistry.py:1.1.2.2
Andreas Jung
andreas@digicool.com
Fri, 1 Mar 2002 20:38:54 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG
In directory cvs.zope.org:/tmp/cvs-serv8324
Modified Files:
Tag: ajung-textindexng-branch
TextIndexNG.py ConverterRegistry.py
Log Message:
added new tab "Converters"
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/TextIndexNG.py 1.2.2.47 => 1.2.2.48 ===
'action': 'manage_normalizer',
'help': ('TextIndex','TextIndex_Settings.stx')},
+ {'label': 'Converters',
+ 'action': 'manage_converters',
+ 'help': ('TextIndex','TextIndex_Settings.stx')},
{'label': 'Test',
'action': 'manage_test',
'help': ('TextIndex','TextIndex_Settings.stx')},
@@ -864,6 +867,22 @@
###################################################################
+ # Converters
+ ###################################################################
+
+ def allConverters(self):
+ """ return a list of all registered converters """
+ lst = []
+ used = []
+ for c in ConverterRegistry.Registry.allConverters():
+ if not c in used:
+ used.append(c)
+ lst.append( (c.getType(), c.getDescription(), c.getDependency() ) )
+
+ return lst
+
+
+ ###################################################################
# Testing
###################################################################
@@ -920,6 +939,7 @@
manage_stopwords = DTMLFile("dtml/manageStopWords",globals())
manage_thesaurus = DTMLFile("dtml/manageThesaurus",globals())
manage_normalizer = DTMLFile("dtml/manageNormalizer",globals())
+ manage_converters = DTMLFile("dtml/showConverterRegistry",globals())
manage_test = DTMLFile("dtml/testTextIndexNG",globals())
=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/ConverterRegistry.py 1.1.2.1 => 1.1.2.2 ===
import converters
+
class ConverterRegistry:
""" registry for converters """
@@ -28,8 +29,11 @@
return self.converters[ mimetype ]
def addConverter(self, mimetype=None, instance=None):
- """ map either an extension or a mimetype to a converter function """
- self.converters[ mimetype ] = callback
+ """ map a mimetype to a converter instance """
+ self.converters[ mimetype ] = instance
+
+ def allConverters(self):
+ return self.converters.values()
Registry = ConverterRegistry()