[Erp5-report] r45126 aurel - /erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 6 11:54:24 CEST 2011
Author: aurel
Date: Wed Apr 6 11:54:23 2011
New Revision: 45126
URL: http://svn.erp5.org?rev=45126&view=rev
Log:
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
Modified:
erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py
Modified: erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py?rev=45126&r1=45125&r2=45126&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py [utf8] Wed Apr 6 11:54:23 2011
@@ -103,10 +103,12 @@ class ArchiveTool(BaseTool):
def manage_archive(self, destination_archive_id,
archive_id,
+ source_connection_id=None,
+ source_deferred_connection_id=None,
update_destination_sql_catalog=None,
update_archive_sql_catalog=None,
clear_destination_sql_catalog=None,
- clear_archive_sql_catalog=None,
+ clear_archive_sql_catalog=None,
REQUEST=None, RESPONSE=None):
"""
This method is used to populate an archive from the current catalog
@@ -124,17 +126,16 @@ class ArchiveTool(BaseTool):
# Guess connection id from current catalog
source_catalog = portal_catalog.getSQLCatalog()
source_catalog_id = source_catalog.getId()
- source_connection_id = None
- source_deferred_connection_id = None
- for method in source_catalog.objectValues():
- if method.meta_type == "Z SQL Method":
- if 'deferred' in method.connection_id:
- source_deferred_connection_id = method.connection_id
- elif 'transactionless' not in method.connection_id:
- source_connection_id = method.connection_id
- if source_connection_id is not None and \
- source_deferred_connection_id is not None:
- break
+ if source_connection_id is None or source_deferred_connection_id is None:
+ for method in source_catalog.objectValues():
+ if method.meta_type == "Z SQL Method":
+ if source_deferred_connection_id is None and 'deferred' in method.connection_id:
+ source_deferred_connection_id = method.connection_id
+ elif source_connection_id is None and 'transactionless' not in method.connection_id:
+ source_connection_id = method.connection_id
+ if source_connection_id is not None and \
+ source_deferred_connection_id is not None:
+ break
if source_connection_id is None or source_deferred_connection_id is None:
raise ValueError, "Unable to determine connection id for the current catalog"
More information about the Erp5-report
mailing list