[Zope-Checkins] SVN: Zope/trunk/src/Products/PluginIndexes/__init__.py Remove module-scope import aliases, use of exec.
Tres Seaver
tseaver at palladion.com
Mon Apr 12 10:08:59 EDT 2010
Log message for revision 110746:
Remove module-scope import aliases, use of exec.
Changed:
U Zope/trunk/src/Products/PluginIndexes/__init__.py
-=-
Modified: Zope/trunk/src/Products/PluginIndexes/__init__.py
===================================================================
--- Zope/trunk/src/Products/PluginIndexes/__init__.py 2010-04-12 14:07:06 UTC (rev 110745)
+++ Zope/trunk/src/Products/PluginIndexes/__init__.py 2010-04-12 14:08:59 UTC (rev 110746)
@@ -11,41 +11,83 @@
#
##############################################################################
-import PathIndex.PathIndex
-import FieldIndex.FieldIndex
-import KeywordIndex.KeywordIndex
-import TopicIndex.TopicIndex
-import DateIndex.DateIndex
-import DateRangeIndex.DateRangeIndex
-
-from Products.PluginIndexes.common import ResultList
-from Products.PluginIndexes.common import UnIndex
-
-_indexes = ('KeywordIndex',
- 'FieldIndex',
- 'PathIndex',
- 'TopicIndex',
- 'DateIndex',
- 'DateRangeIndex',
- )
-
def initialize(context):
- for idx in _indexes:
+ from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
+ from Products.PluginIndexes.FieldIndex.FieldIndex \
+ import manage_addFieldIndex
+ from Products.PluginIndexes.FieldIndex.FieldIndex \
+ import manage_addFieldIndexForm
+ context.registerClass(FieldIndex,
+ permission='Add Pluggable Index',
+ constructors=(manage_addFieldIndexForm,
+ manage_addFieldIndex),
+ icon='www/index.gif',
+ visibility=None,
+ )
- s = "context.registerClass( \
- %s.%s.%s,\
- permission='Add Pluggable Index', \
- constructors=(manage_add%sForm,\
- manage_add%s),\
- icon='www/index.gif',\
- visibility=None\
- )" % (idx,idx,idx,idx,idx)
+ from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex
+ from Products.PluginIndexes.KeywordIndex.KeywordIndex \
+ import manage_addKeywordIndex
+ from Products.PluginIndexes.KeywordIndex.KeywordIndex \
+ import manage_addKeywordIndexForm
+ context.registerClass(KeywordIndex,
+ permission='Add Pluggable Index',
+ constructors=(manage_addKeywordIndexForm,
+ manage_addKeywordIndex),
+ icon='www/index.gif',
+ visibility=None,
+ )
- exec(s)
+ from Products.PluginIndexes.TopicIndex.TopicIndex import TopicIndex
+ from Products.PluginIndexes.TopicIndex.TopicIndex \
+ import manage_addTopicIndex
+ from Products.PluginIndexes.TopicIndex.TopicIndex \
+ import manage_addTopicIndexForm
+ context.registerClass(TopicIndex,
+ permission='Add Pluggable Index',
+ constructors=(manage_addTopicIndexForm,
+ manage_addTopicIndex),
+ icon='www/index.gif',
+ visibility=None,
+ )
+ from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
+ from Products.PluginIndexes.DateIndex.DateIndex \
+ import manage_addDateIndex
+ from Products.PluginIndexes.DateIndex.DateIndex \
+ import manage_addDateIndexForm
+ context.registerClass(DateIndex,
+ permission='Add Pluggable Index',
+ constructors=(manage_addDateIndexForm,
+ manage_addDateIndex),
+ icon='www/index.gif',
+ visibility=None,
+ )
-for idx in _indexes:
+ from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
+ import DateRangeIndex
+ from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
+ import manage_addDateRangeIndex
+ from Products.PluginIndexes.DateRangeIndex.DateRangeIndex \
+ import manage_addDateRangeIndexForm
+ context.registerClass(DateRangeIndex,
+ permission='Add Pluggable Index',
+ constructors=(manage_addDateRangeIndexForm,
+ manage_addDateRangeIndex),
+ icon='www/index.gif',
+ visibility=None,
+ )
- exec("manage_add%sForm = %s.%s.manage_add%sForm" % (idx,idx,idx,idx))
- exec("manage_add%s = %s.%s.manage_add%s" % (idx,idx,idx,idx))
+ from Products.PluginIndexes.PathIndex.PathIndex import PathIndex
+ from Products.PluginIndexes.PathIndex.PathIndex \
+ import manage_addPathIndex
+ from Products.PluginIndexes.PathIndex.PathIndex \
+ import manage_addPathIndexForm
+ context.registerClass(PathIndex,
+ permission='Add Pluggable Index',
+ constructors=(manage_addPathIndexForm,
+ manage_addPathIndex),
+ icon='www/index.gif',
+ visibility=None,
+ )
More information about the Zope-Checkins
mailing list