Update for default namespace


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28223 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bfc2fe00
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import smtplib # to send emails import smtplib # to send emails
from Publication import Publication,Subscriber from Publication import Publication,Subscriber
from Subscription import Signature from Signature import Signature
from XMLSyncUtils import XMLSyncUtils from XMLSyncUtils import XMLSyncUtils
from Conduit.ERP5Conduit import ERP5Conduit from Conduit.ERP5Conduit import ERP5Conduit
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
...@@ -79,7 +79,10 @@ class PublicationSynchronization(XMLSyncUtils): ...@@ -79,7 +79,10 @@ class PublicationSynchronization(XMLSyncUtils):
subscriber.setTargetURI(self.getSourceURI(xml_client)) subscriber.setTargetURI(self.getSourceURI(xml_client))
cmd_id = 1 # specifies a SyncML message-unique command identifier 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 # syncml header
xml.append(self.SyncMLHeader(subscriber.getSessionId(), xml.append(self.SyncMLHeader(subscriber.getSessionId(),
subscriber.getMessageId(), subscriber.getMessageId(),
...@@ -88,12 +91,11 @@ class PublicationSynchronization(XMLSyncUtils): ...@@ -88,12 +91,11 @@ class PublicationSynchronization(XMLSyncUtils):
# syncml body # syncml body
sync_body = SubElement(xml, 'SyncBody') sync_body = SubElement(xml, 'SyncBody')
#at the begining, the code is initialised at UNAUTHORIZED #at the begining, the code is initialised at UNAUTHORIZED
auth_code = self.UNAUTHORIZED auth_code = self.UNAUTHORIZED
if not cred: if not cred:
auth_code = self.AUTH_REQUIRED 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 # Prepare the xml message for the Sync initialization package
sync_body.append(self.SyncMLChal(cmd_id, "SyncHdr", sync_body.append(self.SyncMLChal(cmd_id, "SyncHdr",
publication.getPublicationUrl(), subscriber.getSubscriptionUrl(), publication.getPublicationUrl(), subscriber.getSubscriptionUrl(),
...@@ -144,17 +146,19 @@ class PublicationSynchronization(XMLSyncUtils): ...@@ -144,17 +146,19 @@ class PublicationSynchronization(XMLSyncUtils):
if plugin.authenticateCredentials( if plugin.authenticateCredentials(
{'login':login, 'password':password}) is not None: {'login':login, 'password':password}) is not None:
subscriber.setAuthenticated(True) subscriber.setAuthenticated(True)
auth_code = self.AUTH_ACCEPTED
LOG("PubSyncInit Authentication Accepted", INFO, '') LOG("PubSyncInit Authentication Accepted", INFO, '')
auth_code = self.AUTH_ACCEPTED
#here we must log in with the user authenticated : #here we must log in with the user authenticated :
user = uf.getUserById(login).__of__(uf) user = uf.getUserById(login).__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
subscriber.setUser(login) subscriber.setUser(login)
break break
else: else:
LOG("PubSyncInit Authentication Failed !! with login :", INFO, login)
auth_code = self.UNAUTHORIZED auth_code = self.UNAUTHORIZED
#in all others cases, the auth_code is set to 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 # Prepare the xml message for the Sync initialization package
if auth_code == self.AUTH_ACCEPTED: if auth_code == self.AUTH_ACCEPTED:
......
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