[Erp5-report] r19203 - /erp5/trunk/products/ERP5Security/ERP5GroupManager.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Feb 9 15:14:36 CET 2008


Author: jp
Date: Sat Feb  9 15:14:36 2008
New Revision: 19203

URL: http://svn.erp5.org?rev=19203&view=rev
Log:
Make it easier to reconfigure the database connection of an existing site.

Modified:
    erp5/trunk/products/ERP5Security/ERP5GroupManager.py

Modified: erp5/trunk/products/ERP5Security/ERP5GroupManager.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Security/ERP5GroupManager.py?rev=19203&r1=19202&r2=19203&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Security/ERP5GroupManager.py (original)
+++ erp5/trunk/products/ERP5Security/ERP5GroupManager.py Sat Feb  9 15:14:36 2008
@@ -26,6 +26,7 @@
 from Products.ERP5Type.Cache import CachingMethod
 from Products.PluggableAuthService.PropertiedUser import PropertiedUser
 from ZODB.POSException import ConflictError
+from Shared.DC.ZRDB.DA import DatabaseError
 
 import sys
 
@@ -183,10 +184,23 @@
                                              id='ERP5GroupManager_getGroupsForPrincipal',
                                              cache_factory='erp5_content_short')
 
-    return _getGroupsForPrincipal(
+    try:
+      return _getGroupsForPrincipal(
                 user_name=principal.getId(),
                 path=self.getPhysicalPath())
-
+    except ConflictError:
+      raise
+    except:
+      # Hiding this exception is necessary in order
+      # to be able to configure database connection
+      # on a existing site.
+      # Improved version may use ProgrammingError
+      # and DatabaseError exceptions explicitely
+      LOG('ERP5GroupManager', WARNING,
+          'could not call _getGroupsForPrincipal probably because of '
+          'misconfigured database connection',
+                  error = sys.exc_info())
+      return ()
 
 classImplements( ERP5GroupManager
                , IGroupsPlugin




More information about the Erp5-report mailing list