Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
erp5
Commits
5165ac8a
Commit
5165ac8a
authored
Dec 04, 2023
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_archive: add READ-COMMITTED connection.
parent
d95690fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
1 deletion
+84
-1
bt5/erp5_archive/TestTemplateItem/portal_components/test.erp5.testArchive.py
...stTemplateItem/portal_components/test.erp5.testArchive.py
+17
-0
bt5/erp5_archive/ToolComponentTemplateItem/portal_components/tool.erp5.ArchiveTool.py
...ntTemplateItem/portal_components/tool.erp5.ArchiveTool.py
+14
-1
product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/Archive/read_committed_connection_id_property.xml
..._sheets/Archive/read_committed_connection_id_property.xml
+53
-0
No files found.
bt5/erp5_archive/TestTemplateItem/portal_components/test.erp5.testArchive.py
View file @
5165ac8a
...
...
@@ -27,6 +27,7 @@
#
##############################################################################
import
re
import
time
import
unittest
...
...
@@ -176,6 +177,13 @@ class TestArchive(InventoryAPITestCase):
addSQLConnection
(
self
.
new_connection_id
,
''
,
db1
)
new_connection
=
portal
[
self
.
new_connection_id
]
new_connection
.
manage_open_connection
()
# the READ-COMMITTED one
self
.
new_read_committed_connection_id
=
'erp5_sql_read_committed_connection1'
addSQLConnection
(
self
.
new_read_committed_connection_id
,
''
,
re
.
sub
(
r'((?:[%*][^ ]+ )*)(![^ ]+ )?(.+)'
,
r'\1!READ-COMMITTED \3'
,
db1
))
new_connection
=
portal
[
self
.
new_read_committed_connection_id
]
new_connection
.
manage_open_connection
()
# the deferred one
self
.
new_deferred_connection_id
=
'erp5_sql_connection2'
addSQLConnection
(
self
.
new_deferred_connection_id
,
''
,
db1
)
...
...
@@ -187,6 +195,13 @@ class TestArchive(InventoryAPITestCase):
addSQLConnection
(
self
.
archive_connection_id
,
''
,
db2
)
archive_connection
=
portal
[
self
.
archive_connection_id
]
archive_connection
.
manage_open_connection
()
# the READ-COMMITTED one
self
.
archive_read_committed_connection_id
=
'erp5_sql_read_committed_connection3'
addSQLConnection
(
self
.
archive_read_committed_connection_id
,
''
,
re
.
sub
(
r'((?:[%*][^ ]+ )*)(![^ ]+ )?(.+)'
,
r'\1!READ-COMMITTED \3'
,
db2
))
archive_connection
=
portal
[
self
.
archive_read_committed_connection_id
]
archive_connection
.
manage_open_connection
()
# the deferred one
self
.
archive_deferred_connection_id
=
'erp5_sql_connection4'
addSQLConnection
(
self
.
archive_deferred_connection_id
,
''
,
db2
)
...
...
@@ -212,6 +227,7 @@ class TestArchive(InventoryAPITestCase):
archive
=
portal_archive
.
newContent
(
portal_type
=
"Archive"
,
catalog_id
=
self
.
archive_catalog_id
,
connection_id
=
self
.
archive_connection_id
,
read_committed_connection_id
=
self
.
archive_read_committed_connection_id
,
deferred_connection_id
=
self
.
archive_deferred_connection_id
,
priority
=
3
,
inventory_method_id
=
'Archive_createAllInventory'
,
...
...
@@ -224,6 +240,7 @@ class TestArchive(InventoryAPITestCase):
dest
=
portal_archive
.
newContent
(
portal_type
=
"Archive"
,
catalog_id
=
self
.
new_catalog_id
,
connection_id
=
self
.
new_connection_id
,
read_committed_connection_id
=
self
.
new_read_committed_connection_id
,
deferred_connection_id
=
self
.
new_deferred_connection_id
,
priority
=
1
,
test_method_id
=
'Archive_test'
,
...
...
bt5/erp5_archive/ToolComponentTemplateItem/portal_components/tool.erp5.ArchiveTool.py
View file @
5165ac8a
...
...
@@ -123,9 +123,10 @@ class ArchiveTool(BaseTool):
source_catalog_id
=
source_catalog
.
getId
()
source_connection_id
=
source_catalog
.
getConnectionId
()
source_read_committed_connection_id
=
source_catalog
.
getConnectionId
(
read_committed
=
True
)
source_deferred_connection_id
=
source_catalog
.
getConnectionId
(
deferred
=
True
)
if
source_connection_id
is
None
or
source_deferred_connection_id
is
None
:
if
source_connection_id
is
None
or
source_
read_committed_connection_id
is
None
or
source_
deferred_connection_id
is
None
:
raise
ValueError
(
"Unable to determine connection id for the current catalog"
)
# Get destination property from archive
...
...
@@ -133,6 +134,7 @@ class ArchiveTool(BaseTool):
destination_archive
=
self
.
_getOb
(
destination_archive_id
)
destination_sql_catalog_id
=
destination_archive
.
getCatalogId
()
destination_connection_id
=
destination_archive
.
getConnectionId
()
destination_read_committed_connection_id
=
destination_archive
.
getReadCommittedConnectionId
()
destination_deferred_connection_id
=
destination_archive
.
getDeferredConnectionId
()
# Get archive property from archive
...
...
@@ -140,6 +142,7 @@ class ArchiveTool(BaseTool):
archive
=
self
.
_getOb
(
archive_id
)
archive_sql_catalog_id
=
archive
.
getCatalogId
()
archive_connection_id
=
archive
.
getConnectionId
()
archive_read_committed_connection_id
=
archive
.
getReadCommittedConnectionId
()
archive_deferred_connection_id
=
archive
.
getDeferredConnectionId
()
# Check we don't use same connection id for source and destination
...
...
@@ -147,6 +150,8 @@ class ArchiveTool(BaseTool):
raise
ValueError
(
"Destination and source catalog can't be the same"
)
if
destination_connection_id
==
source_connection_id
:
raise
ValueError
(
"Destination and source connection can't be the same"
)
if
destination_read_committed_connection_id
==
source_read_committed_connection_id
:
raise
ValueError
(
"Destination and source READ-COMMITTED connection can't be the same"
)
if
destination_deferred_connection_id
==
source_deferred_connection_id
:
raise
ValueError
(
"Destination and source deferred connection can't be the same"
)
# Same for source and archive
...
...
@@ -154,6 +159,8 @@ class ArchiveTool(BaseTool):
raise
ValueError
(
"Archive and source catalog can't be the same"
)
if
archive_connection_id
==
source_connection_id
:
raise
ValueError
(
"Archive and source connection can't be the same"
)
if
archive_read_committed_connection_id
==
source_read_committed_connection_id
:
raise
ValueError
(
"Archive and source READ-COMMITTED connection can't be the same"
)
if
archive_deferred_connection_id
==
source_deferred_connection_id
:
raise
ValueError
(
"Archive and source deferred connection can't be the same"
)
# Same for destination and archive
...
...
@@ -161,6 +168,8 @@ class ArchiveTool(BaseTool):
raise
ValueError
(
"Archive and destination catalog can't be the same"
)
if
archive_connection_id
==
destination_connection_id
:
raise
ValueError
(
"Archive and destination connection can't be the same"
)
if
archive_read_committed_connection_id
==
destination_read_committed_connection_id
:
raise
ValueError
(
"Archive and destination READ-COMMITED connection can't be the same"
)
if
archive_deferred_connection_id
==
destination_deferred_connection_id
:
raise
ValueError
(
"Archive and destination deferred connection can't be the same"
)
...
...
@@ -168,6 +177,7 @@ class ArchiveTool(BaseTool):
destination_sql_catalog
=
getattr
(
portal_catalog
,
destination_sql_catalog_id
)
if
update_destination_sql_catalog
:
sql_connection_id_dict
=
{
source_connection_id
:
destination_connection_id
,
source_read_committed_connection_id
:
destination_read_committed_connection_id
,
source_deferred_connection_id
:
destination_deferred_connection_id
}
portal_catalog
.
changeSQLConnectionIds
(
destination_sql_catalog
,
sql_connection_id_dict
)
...
...
@@ -175,6 +185,7 @@ class ArchiveTool(BaseTool):
archive_sql_catalog
=
getattr
(
portal_catalog
,
archive_sql_catalog_id
)
if
update_archive_sql_catalog
:
sql_connection_id_dict
=
{
source_connection_id
:
archive_connection_id
,
source_read_committed_connection_id
:
archive_read_committed_connection_id
,
source_deferred_connection_id
:
archive_deferred_connection_id
}
portal_catalog
.
changeSQLConnectionIds
(
archive_sql_catalog
,
sql_connection_id_dict
)
...
...
@@ -194,8 +205,10 @@ class ArchiveTool(BaseTool):
destination_sql_catalog_id
=
destination_sql_catalog_id
,
archive_path
=
archive
.
getPath
(),
source_sql_connection_id_list
=
[
source_connection_id
,
\
source_read_committed_connection_id
,
source_deferred_connection_id
],
destination_sql_connection_id_list
=
[
destination_connection_id
,
\
destination_read_committed_connection_id
,
destination_deferred_connection_id
],
REQUEST
=
REQUEST
,
RESPONSE
=
RESPONSE
)
...
...
product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/Archive/read_committed_connection_id_property.xml
0 → 100644
View file @
5165ac8a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
mode
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
string
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/string
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
The id of the READ-COMMITTED connection used by the archive
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
read_committed_connection_id_property
</string>
</value>
</item>
<item>
<key>
<string>
mode
</string>
</key>
<value>
<string>
w
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment