[Zope-Checkins] SVN: Zope/trunk/src/Products/ZCatalog/ZCatalogIndexes.py PEP8 and some more readable code
Hanno Schlichting
hannosch at hannosch.eu
Sun Aug 1 06:28:57 EDT 2010
Log message for revision 115309:
PEP8 and some more readable code
Changed:
U Zope/trunk/src/Products/ZCatalog/ZCatalogIndexes.py
-=-
Modified: Zope/trunk/src/Products/ZCatalog/ZCatalogIndexes.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/ZCatalogIndexes.py 2010-08-01 10:22:07 UTC (rev 115308)
+++ Zope/trunk/src/Products/ZCatalog/ZCatalogIndexes.py 2010-08-01 10:28:56 UTC (rev 115309)
@@ -35,7 +35,7 @@
the requested indexes in an object manager."""
# The interfaces we want to show up in our object manager
- _product_interfaces = (IPluggableIndex,)
+ _product_interfaces = (IPluggableIndex, )
meta_type = "ZCatalogIndex"
manage_options = ()
@@ -43,9 +43,9 @@
security = ClassSecurityInfo()
security.declareObjectProtected(manage_zcatalog_indexes)
- security.setPermissionDefault(manage_zcatalog_indexes, ('Manager',))
+ security.setPermissionDefault(manage_zcatalog_indexes, ('Manager', ))
security.declareProtected(manage_zcatalog_indexes, 'addIndexForm')
- addIndexForm= DTMLFile('dtml/addIndexForm',globals())
+ addIndexForm= DTMLFile('dtml/addIndexForm', globals())
# You no longer manage the Indexes here, they are managed from ZCatalog
def manage_main(self, REQUEST, RESPONSE):
@@ -77,20 +77,19 @@
security.declareProtected(manage_zcatalog_indexes, 'objectIds')
def objectIds(self, spec=None):
-
indexes = aq_parent(self)._catalog.indexes
if spec is not None:
- if type(spec) == type('s'):
+ if isinstance(spec, str):
spec = [spec]
- set = []
+ result = []
for ob in indexes.keys():
o = indexes.get(ob)
- if hasattr(o, 'meta_type') and getattr(o,'meta_type') in spec:
- set.append(ob)
+ meta = getattr(o, 'meta_type', None)
+ if meta is not None and meta in spec:
+ result.append(ob)
+ return result
- return set
-
return indexes.keys()
# Eat _setObject calls
@@ -102,11 +101,11 @@
#
def __bobo_traverse__(self, REQUEST, name):
- indexes = aq_parent(self)._catalog.indexes;
+ indexes = aq_parent(self)._catalog.indexes
o = indexes.get(name, None)
if o is not None:
- if getattr(o,'manage_workspace', None) is None:
+ if getattr(o, 'manage_workspace', None) is None:
o = OldCatalogWrapperObject(o)
return o.__of__(self)
@@ -122,7 +121,7 @@
'action': 'manage_main'},
)
- manage_main = DTMLFile('dtml/manageOldindex',globals())
+ manage_main = DTMLFile('dtml/manageOldindex', globals())
manage_main._setName('manage_main')
manage_workspace = manage_main
More information about the Zope-Checkins
mailing list