From 0b7e0f8703562e2bde07943b7710b655eec0f033 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Mon, 30 Apr 2007 15:25:13 +0000
Subject: [PATCH] by Nicolas, allow to specify product name when importing a
 conduit

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14281 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5SyncML/XMLSyncUtils.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/product/ERP5SyncML/XMLSyncUtils.py b/product/ERP5SyncML/XMLSyncUtils.py
index 296599e126..76b9ef0d8b 100644
--- a/product/ERP5SyncML/XMLSyncUtils.py
+++ b/product/ERP5SyncML/XMLSyncUtils.py
@@ -1118,9 +1118,16 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
 
     alert_code = self.getAlertCode(remote_xml)
     # Import the conduit and get it
-    conduit_name = subscriber.getConduit()
-    conduit_module = __import__('.'.join([Conduit.__name__, conduit_name]), globals(), locals(), [''])
-    conduit = getattr(conduit_module, conduit_name)()
+    if conduit_name.startswith('Products'):
+      path = conduit_name
+      conduit_name = conduit_name.split('.')[-1]
+      LOG('SyncMLUtils.SyncModif (path,conduit_name)',0,(path,conduit_name))
+      conduit_module = __import__(path, globals(), locals(), [''])
+      conduit = getattr(conduit_module, conduit_name)()
+    else:
+      conduit_module = __import__('.'.join([Conduit.__name__, conduit_name]), 
+                                  globals(), locals(), [''])
+      conduit = getattr(conduit_module, conduit_name)()
     LOG('SyncModif, subscriber:',0,subscriber)
     # Then apply the list of actions
     (xml_confirmation,has_next_action,cmd_id) = self.applyActionList(cmd_id=cmd_id,
-- 
2.30.9