[Zope-CVS] CVS: Products/QueueCatalog - QueueCatalog.py:1.8
Jens Vagelpohl
jens@zope.com
Mon, 14 Oct 2002 13:27:50 -0400
Update of /cvs-repository/Products/QueueCatalog
In directory cvs.zope.org:/tmp/cvs-serv25336
Modified Files:
QueueCatalog.py
Log Message:
- use isinstance checks instead of type
- import StringType from types instead of creating it myself
=== Products/QueueCatalog/QueueCatalog.py 1.7 => 1.8 ===
--- Products/QueueCatalog/QueueCatalog.py:1.7 Tue Oct 8 10:20:55 2002
+++ Products/QueueCatalog/QueueCatalog.py Mon Oct 14 13:27:49 2002
@@ -29,8 +29,7 @@
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Globals import DTMLFile
from Acquisition import Implicit, aq_base, aq_inner, aq_parent
-
-StringType = type('')
+from types import StringType
_zcatalog_methods = {
'catalog_object': 1,
@@ -205,7 +204,7 @@
if uid is None:
uid = '/'.join(obj.getPhysicalPath())
- elif type(uid) is not StringType:
+ elif not isinstance(uid, StringType):
uid = '/'.join(uid)
catalog = self.getZCatalog()
@@ -240,7 +239,10 @@
if self._immediate_indexes:
# Update some of the indexes immediately.
- catalog.catalog_object(obj, uid, self._immediate_indexes)
+ try:
+ catalog.catalog_object(obj, uid, self._immediate_indexes)
+ except:
+ pass
def uncatalog_object(self, uid):
@@ -248,7 +250,7 @@
# Make sure the current context is allowed to to this:
self.getZCatalog('uncatalog_object')
- if type(uid) is not StringType:
+ if not isinstance(uid, StringType):
uid = '/'.join(uid)
self._update(uid, REMOVED)
@@ -272,7 +274,11 @@
continue
# Note that the uid may be relative to the catalog.
obj = catalog.unrestrictedTraverse(uid)
- catalog.catalog_object(obj, uid)
+ try:
+ catalog.catalog_object(obj, uid)
+ except:
+ # Something went wrong, put back in the queue
+ self._update(uid, event)
#
# CMF catalog tool methods.
@@ -340,10 +346,7 @@
self.process()
msg = 'Queue processed'
- return self.manage_queue( self
- , REQUEST
- , manage_tabs_message=msg
- )
+ return self.manage_queue(manage_tabs_message=msg)
# Provide Zope 2 offerings