From e403864b6ba532fafc44235c70ea162d476c14a2 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Wed, 21 Jan 2009 10:46:34 +0000
Subject: [PATCH] Target and Source should be both inside tree

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

diff --git a/product/ERP5SyncML/XMLSyncUtils.py b/product/ERP5SyncML/XMLSyncUtils.py
index 0cdff41132..7524333101 100644
--- a/product/ERP5SyncML/XMLSyncUtils.py
+++ b/product/ERP5SyncML/XMLSyncUtils.py
@@ -52,22 +52,20 @@ class XMLSyncUtilsMixin(SyncCode):
       Since the Header is always almost the same, this is the
       way to set one quickly.
     """
-    if source:
-      if source_name:
-        source_name = source_name.decode('utf-8')
-      node_to_append = E.Source(E.LocURI(source), E.LocName(source_name or ''))
-    else:
-      if target_name:
-        target_name = target_name.decode('utf-8')
-      node_to_append = E.Target(E.LocURI(target), E.LocName(target_name or ''))
-
     xml = (E.SyncHdr(
             E.VerDTD('1.1'),
             E.VerProto('SyncML/1.1'),
             E.SessionID('%s' % session_id),
             E.MsgID('%s' % msg_id),
-            node_to_append
           ))
+    target_node = E.Target(E.LocURI(target))
+    if target_name:
+      target_node.append(E.LocName(target_name.decode('utf-8')))
+    xml.append(target_node)
+    source_node = E.Source(E.LocURI(source))
+    if source_name:
+      source_node.append(E.LocName(source_name.decode('utf-8')))
+    xml.append(source_node)
     if dataCred:
       xml.append(E.Cred(
                   E.Meta(E.Format(authentication_format, xmlns='syncml:metinf'),
-- 
2.30.9