Commit 453cdf79 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! ERP5Site: add erp5_sql_isolated_connection.

parent 74d4341e
...@@ -85,7 +85,6 @@ def manage_addERP5Site(self, ...@@ -85,7 +85,6 @@ def manage_addERP5Site(self,
validate_email=0, validate_email=0,
erp5_catalog_storage='erp5_mysql_innodb_catalog', erp5_catalog_storage='erp5_mysql_innodb_catalog',
erp5_sql_connection_string=default_sql_connection_string, erp5_sql_connection_string=default_sql_connection_string,
erp5_sql_read_committed_connection_string=default_sql_connection_string,
cmf_activity_sql_connection_string=default_sql_connection_string, cmf_activity_sql_connection_string=default_sql_connection_string,
bt5_repository_url='', bt5_repository_url='',
bt5='', bt5='',
...@@ -105,7 +104,6 @@ def manage_addERP5Site(self, ...@@ -105,7 +104,6 @@ def manage_addERP5Site(self,
create_userfolder, create_userfolder,
erp5_catalog_storage, erp5_catalog_storage,
erp5_sql_connection_string, erp5_sql_connection_string,
erp5_sql_read_committed_connection_string,
cmf_activity_sql_connection_string, cmf_activity_sql_connection_string,
bt5_repository_url, bt5_repository_url,
bt5, bt5,
...@@ -2117,7 +2115,6 @@ class ERP5Generator(PortalGenerator): ...@@ -2117,7 +2115,6 @@ class ERP5Generator(PortalGenerator):
create_userfolder, create_userfolder,
erp5_catalog_storage, erp5_catalog_storage,
erp5_sql_connection_string, erp5_sql_connection_string,
erp5_sql_read_committed_connection_string,
cmf_activity_sql_connection_string, cmf_activity_sql_connection_string,
bt5_repository_url, bt5_repository_url,
bt5, bt5,
...@@ -2142,13 +2139,11 @@ class ERP5Generator(PortalGenerator): ...@@ -2142,13 +2139,11 @@ class ERP5Generator(PortalGenerator):
# Return the fully wrapped object. # Return the fully wrapped object.
p = parent.this()._getOb(id) p = parent.this()._getOb(id)
erp5_sql_deferred_connection_string = erp5_sql_read_committed_connection_string erp5_sql_deferred_connection_string = erp5_sql_connection_string
p._setProperty('erp5_catalog_storage', p._setProperty('erp5_catalog_storage',
erp5_catalog_storage, 'string') erp5_catalog_storage, 'string')
p._setProperty('erp5_sql_connection_string', p._setProperty('erp5_sql_connection_string',
erp5_sql_connection_string, 'string') erp5_sql_connection_string, 'string')
p._setProperty('erp5_sql_read_committed_connection_string',
erp5_sql_read_committed_connection_string, 'string')
p._setProperty('erp5_sql_deferred_connection_string', p._setProperty('erp5_sql_deferred_connection_string',
erp5_sql_deferred_connection_string, 'string') erp5_sql_deferred_connection_string, 'string')
p._setProperty('cmf_activity_sql_connection_string', p._setProperty('cmf_activity_sql_connection_string',
...@@ -2298,6 +2293,8 @@ class ERP5Generator(PortalGenerator): ...@@ -2298,6 +2293,8 @@ class ERP5Generator(PortalGenerator):
# minus prepended to the connection string. # minus prepended to the connection string.
if id == 'erp5_sql_transactionless_connection': if id == 'erp5_sql_transactionless_connection':
connection_string = re.sub(r'((?:[%*][^ ]+ )*)(![^ ]+ )?(.+)', r'\1-\3', p.cmf_activity_sql_connection_string) connection_string = re.sub(r'((?:[%*][^ ]+ )*)(![^ ]+ )?(.+)', r'\1-\3', p.cmf_activity_sql_connection_string)
elif id == 'erp5_sql_read_committed_connection':
connection_string = re.sub(r'((?:[%*][^ ]+ )*)(![^ ]+ )?(.+)', r'\1!READ-COMMITTED \3', p.erp5_sql_connection_string)
else: else:
connection_string = getattr(p, id + '_string') connection_string = getattr(p, id + '_string')
manage_add(id, title, connection_string, **kw) manage_add(id, title, connection_string, **kw)
...@@ -2611,8 +2608,8 @@ def initialize(self): ...@@ -2611,8 +2608,8 @@ def initialize(self):
from Products.ZMySQLDA.db import DB, OperationalError from Products.ZMySQLDA.db import DB, OperationalError
def addERP5Site(REQUEST): def addERP5Site(REQUEST):
default_kw = inspect.getcallargs(manage_addERP5Site, None, '') default_kw = inspect.getcallargs(manage_addERP5Site, None, '')
db = (kw.get('erp5_sql_read_committed_connection_string') or db = (kw.get('erp5_sql_connection_string') or
default_kw['erp5_sql_read_committed_connection_string']) default_kw['erp5_sql_connection_string'])
# The lock is to avoid that multiple zopes try to create a site when # The lock is to avoid that multiple zopes try to create a site when
# they're started at the same time, because this is a quite long operation # they're started at the same time, because this is a quite long operation
# (-> high probably of conflict with a lot of wasted CPU). # (-> high probably of conflict with a lot of wasted CPU).
......
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