Commit 995cdc40 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Make it easier to reconfigure the database connection of an existing site.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19203 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1fa44ac1
...@@ -26,6 +26,7 @@ from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin ...@@ -26,6 +26,7 @@ from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.PluggableAuthService.PropertiedUser import PropertiedUser from Products.PluggableAuthService.PropertiedUser import PropertiedUser
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from Shared.DC.ZRDB.DA import DatabaseError
import sys import sys
...@@ -183,10 +184,23 @@ class ERP5GroupManager(BasePlugin): ...@@ -183,10 +184,23 @@ class ERP5GroupManager(BasePlugin):
id='ERP5GroupManager_getGroupsForPrincipal', id='ERP5GroupManager_getGroupsForPrincipal',
cache_factory='erp5_content_short') cache_factory='erp5_content_short')
return _getGroupsForPrincipal( try:
return _getGroupsForPrincipal(
user_name=principal.getId(), user_name=principal.getId(),
path=self.getPhysicalPath()) 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 classImplements( ERP5GroupManager
, IGroupsPlugin , IGroupsPlugin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment