Commit c4829371 authored by Aurel's avatar Aurel

reset signature on server side just before checking modifications, it has no meaning otherwise

parent b9e543c0
...@@ -574,7 +574,6 @@ class SyncMLSubscription(XMLObject): ...@@ -574,7 +574,6 @@ class SyncMLSubscription(XMLObject):
media_type=conduit.getContentType()) media_type=conduit.getContentType())
elif signature.getValidationState() in ('not_synchronized', elif signature.getValidationState() in ('not_synchronized',
'synchronized',
'conflict_resolved_with_merge'): 'conflict_resolved_with_merge'):
# We don't have synchronized this object yet but it has a signature # We don't have synchronized this object yet but it has a signature
xml_object = conduit.getXMLFromObjectWithId(document, xml_object = conduit.getXMLFromObjectWithId(document,
...@@ -674,6 +673,10 @@ class SyncMLSubscription(XMLObject): ...@@ -674,6 +673,10 @@ class SyncMLSubscription(XMLObject):
finished = False finished = False
xml_string = signature.getFirstPdataChunk(MAX_LEN) xml_string = signature.getFirstPdataChunk(MAX_LEN)
xml_string = etree.CDATA(xml_string.decode('utf-8')) xml_string = etree.CDATA(xml_string.decode('utf-8'))
elif signature.getValidationState() in ('syncing', 'synchronized"):
raise ValueError("Must not get signature in %s state here, signature is %s"
% (signature.getValidationState(),
signature.getPath(),))
syncml_response.addSyncCommand( syncml_response.addSyncCommand(
sync_command=signature.getPartialAction(), sync_command=signature.getPartialAction(),
......
...@@ -202,9 +202,16 @@ class SyncMLAsynchronousEngine(EngineMixin): ...@@ -202,9 +202,16 @@ class SyncMLAsynchronousEngine(EngineMixin):
if syncml_request.isFinal: if syncml_request.isFinal:
# Server then sends its modifications # Server then sends its modifications
subscriber.sendModifications() subscriber.sendModifications()
# Now that everything is ok, init sync information
if subscriber.getSyncmlAlertCode() not in ("one_way_from_client",
"refresh_from_client_only"):
# Reset signature only if we have to check modifications on server side
subscriber.initialiseSynchronization()
# Start to send modification only once we have processed # Start to send modification only once we have processed
# all message from client # all message from client
after_method_id='processServerSynchronization', after_method_id='processServerSynchronization',
tag = (tag, "%s_reset" % subscriber.getPath(),)
# Do not continue in elif, as sending modifications is done in the same # Do not continue in elif, as sending modifications is done in the same
# package as sending notifications # package as sending notifications
if subscriber.getSynchronizationState() == "sending_modifications": if subscriber.getSynchronizationState() == "sending_modifications":
......
...@@ -437,11 +437,6 @@ class EngineMixin(object): ...@@ -437,11 +437,6 @@ class EngineMixin(object):
last_anchor=subscriber.getLastAnchor(), last_anchor=subscriber.getLastAnchor(),
next_anchor=subscriber.getNextAnchor()) next_anchor=subscriber.getNextAnchor())
# Now that everything is ok, init sync information
if subscriber.getSyncmlAlertCode() not in ("one_way_from_client",
"refresh_from_client_only"):
# Reset signature only if we have to check modifications on server side
subscriber.initialiseSynchronization()
# Server get sync commands from client first # Server get sync commands from client first
subscriber.processSyncRequest() subscriber.processSyncRequest()
else: else:
......
...@@ -182,6 +182,11 @@ class SyncMLSynchronousEngine(EngineMixin): ...@@ -182,6 +182,11 @@ class SyncMLSynchronousEngine(EngineMixin):
if syncml_request.isFinal: if syncml_request.isFinal:
# Server will now send its modifications # Server will now send its modifications
subscriber.sendModifications() subscriber.sendModifications()
if subscriber.getSyncmlAlertCode() not in ("one_way_from_client",
"refresh_from_client_only"):
# Reset signature only if we have to check modifications on server side
subscriber.initialiseSynchronization()
# Do not continue in elif, as sending modifications is done in the same # Do not continue in elif, as sending modifications is done in the same
# package as sending notifications # package as sending notifications
if subscriber.getSynchronizationState() == "sending_modifications": if subscriber.getSynchronizationState() == "sending_modifications":
......
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