Commit 07f480ed authored by Aurel's avatar Aurel

manage_archive can take more argument as the research of currently

used connection might failed in some cases (no zsql method using a
deferred connection for example)

This should be replace later using a mapping between connection as parameter



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45126 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 20cd4ad5
...@@ -103,10 +103,12 @@ class ArchiveTool(BaseTool): ...@@ -103,10 +103,12 @@ class ArchiveTool(BaseTool):
def manage_archive(self, destination_archive_id, def manage_archive(self, destination_archive_id,
archive_id, archive_id,
source_connection_id=None,
source_deferred_connection_id=None,
update_destination_sql_catalog=None, update_destination_sql_catalog=None,
update_archive_sql_catalog=None, update_archive_sql_catalog=None,
clear_destination_sql_catalog=None, clear_destination_sql_catalog=None,
clear_archive_sql_catalog=None, clear_archive_sql_catalog=None,
REQUEST=None, RESPONSE=None): REQUEST=None, RESPONSE=None):
""" """
This method is used to populate an archive from the current catalog This method is used to populate an archive from the current catalog
...@@ -124,17 +126,16 @@ class ArchiveTool(BaseTool): ...@@ -124,17 +126,16 @@ class ArchiveTool(BaseTool):
# Guess connection id from current catalog # Guess connection id from current catalog
source_catalog = portal_catalog.getSQLCatalog() source_catalog = portal_catalog.getSQLCatalog()
source_catalog_id = source_catalog.getId() source_catalog_id = source_catalog.getId()
source_connection_id = None if source_connection_id is None or source_deferred_connection_id is None:
source_deferred_connection_id = None for method in source_catalog.objectValues():
for method in source_catalog.objectValues(): if method.meta_type == "Z SQL Method":
if method.meta_type == "Z SQL Method": if source_deferred_connection_id is None and 'deferred' in method.connection_id:
if 'deferred' in method.connection_id: source_deferred_connection_id = method.connection_id
source_deferred_connection_id = method.connection_id elif source_connection_id is None and 'transactionless' not in method.connection_id:
elif 'transactionless' not in method.connection_id: source_connection_id = method.connection_id
source_connection_id = method.connection_id if source_connection_id is not None and \
if source_connection_id is not None and \ source_deferred_connection_id is not None:
source_deferred_connection_id is not None: break
break
if source_connection_id is None or source_deferred_connection_id is None: if source_connection_id is None or source_deferred_connection_id is None:
raise ValueError, "Unable to determine connection id for the current catalog" raise ValueError, "Unable to determine connection id for the current catalog"
......
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