[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG - ConverterRegistry.py:1.1.2.1
Andreas Jung
andreas@digicool.com
Wed, 27 Feb 2002 19:36:40 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG
In directory cvs.zope.org:/tmp/cvs-serv18439
Added Files:
Tag: ajung-textindexng-branch
ConverterRegistry.py
Log Message:
added
=== Added File Zope/lib/python/Products/PluginIndexes/TextIndexNG/ConverterRegistry.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
__doc__ = """ converter registry """
__version__ = '$Id: ConverterRegistry.py,v 1.1.2.1 2002/02/28 00:36:40 andreasjung Exp $'
import converters
class ConverterRegistry:
""" registry for converters """
def __init__(self):
self.converters = converters._converters
def allTypes(self): return self.converters.keys()
def getConverterFor(self, mimetype):
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
Registry = ConverterRegistry()