[Erp5-report] r28223 - /erp5/trunk/products/ERP5SyncML/PublicationSynchronization.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jul 30 14:25:47 CEST 2009


Author: daniele
Date: Thu Jul 30 14:25:47 2009
New Revision: 28223

URL: http://svn.erp5.org?rev=28223&view=rev
Log:
Update for default namespace

Modified:
    erp5/trunk/products/ERP5SyncML/PublicationSynchronization.py

Modified: erp5/trunk/products/ERP5SyncML/PublicationSynchronization.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/PublicationSynchronization.py?rev=28223&r1=28222&r2=28223&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/PublicationSynchronization.py [utf8] (original)
+++ erp5/trunk/products/ERP5SyncML/PublicationSynchronization.py [utf8] Thu Jul 30 14:25:47 2009
@@ -28,7 +28,7 @@
 
 import smtplib # to send emails
 from Publication import Publication,Subscriber
-from Subscription import Signature
+from Signature import Signature
 from XMLSyncUtils import XMLSyncUtils
 from Conduit.ERP5Conduit import ERP5Conduit
 from Products.CMFCore.utils import getToolByName
@@ -79,7 +79,10 @@
       subscriber.setTargetURI(self.getSourceURI(xml_client))
 
       cmd_id = 1 # specifies a SyncML message-unique command identifier      
-      xml = Element('SyncML')
+     
+      #create element 'SyncML' with a default namespace
+      nsmap = {None : self.XHTML_NAMESPACE}
+      xml = Element('SyncML',nsmap=nsmap)
       # syncml header
       xml.append(self.SyncMLHeader(subscriber.getSessionId(),
         subscriber.getMessageId(),
@@ -88,12 +91,11 @@
       # syncml body
       sync_body = SubElement(xml, 'SyncBody')
 
-
       #at the begining, the code is initialised at UNAUTHORIZED
       auth_code = self.UNAUTHORIZED
       if not cred:
         auth_code = self.AUTH_REQUIRED
-        LOG("PubSyncInit there's no credential !!!", INFO,'')
+        # LOG("PubSyncInit there's no credential !!!", INFO,'')
         # Prepare the xml message for the Sync initialization package
         sync_body.append(self.SyncMLChal(cmd_id, "SyncHdr",
           publication.getPublicationUrl(), subscriber.getSubscriptionUrl(),
@@ -144,17 +146,19 @@
               if plugin.authenticateCredentials(
                         {'login':login, 'password':password}) is not None:
                 subscriber.setAuthenticated(True)
+                LOG("PubSyncInit Authentication Accepted", INFO, '')
                 auth_code = self.AUTH_ACCEPTED
-                LOG("PubSyncInit Authentication Accepted", INFO, '')
                 #here we must log in with the user authenticated :
                 user = uf.getUserById(login).__of__(uf)
                 newSecurityManager(None, user)
                 subscriber.setUser(login)
                 break
               else:
-                LOG("PubSyncInit Authentication Failed !! with login :", INFO, login)
                 auth_code = self.UNAUTHORIZED
+        
         #in all others cases, the auth_code is set to UNAUTHORIZED
+            if auth_code == self.UNAUTHORIZED:
+              LOG("PubSyncInit Authentication Failed !! with login :", INFO, login)
 
         # Prepare the xml message for the Sync initialization package
         if auth_code == self.AUTH_ACCEPTED:




More information about the Erp5-report mailing list