From c722ae807c991f5105a159c1162e0e45980dedb9 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Fri, 12 May 2006 09:31:52 +0000 Subject: [PATCH] Modify code layout. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7237 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZSQLCatalog/SQLCatalog.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py index 9e7ab09dfe..876ccc0172 100644 --- a/product/ZSQLCatalog/SQLCatalog.py +++ b/product/ZSQLCatalog/SQLCatalog.py @@ -599,7 +599,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): except ConflictError: raise except: - LOG('SQLCatalog', WARNING, 'could not clear catalog with %s' % method_name, error=sys.exc_info()) + LOG('SQLCatalog', WARNING, + 'could not clear catalog with %s' % method_name, error=sys.exc_info()) pass # Reserved uids have been removed. @@ -624,7 +625,15 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): """ method_id = self.sql_catalog_clear_reserved method = getattr(self, method_id) - method() + try: + method() + except ConflictError: + raise + except: + LOG('SQLCatalog', WARNING, + 'could not clear reserved catalog with %s' % \ + method_id, error=sys.exc_info()) + raise self._last_clear_reserved_time += 1 def __getitem__(self, uid): @@ -899,19 +908,22 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): 'Total time: %s<br>' 'Total CPU time: %s' % (`elapse`, `c_elapse`))) - def manage_catalogClear(self, REQUEST=None, RESPONSE=None, URL1=None, sql_catalog_id=None): + def manage_catalogClear(self, REQUEST=None, RESPONSE=None, + URL1=None, sql_catalog_id=None): """ clears the whole enchilada """ self.clear() if RESPONSE and URL1: - RESPONSE.redirect(URL1 + '/manage_catalogAdvanced?manage_tabs_message=Catalog%20Cleared') + RESPONSE.redirect('%s/manage_catalogAdvanced?' \ + 'manage_tabs_message=Catalog%20Cleared' % URL1) def manage_catalogClearReserved(self, REQUEST=None, RESPONSE=None, URL1=None): """ clears the whole enchilada """ self.clearReserved() if RESPONSE and URL1: - RESPONSE.redirect(URL1 + '/manage_catalogAdvanced?manage_tabs_message=Catalog%20Cleared') + RESPONSE.redirect('%s/manage_catalogAdvanced?' \ + 'manage_tabs_message=Catalog%20Cleared' % URL1) def manage_catalogFoundItems(self, REQUEST, RESPONSE, URL2, URL1, obj_metatypes=None, -- 2.30.9