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):
media_type=conduit.getContentType())
elif signature.getValidationState() in ('not_synchronized',
'synchronized',
'conflict_resolved_with_merge'):
# We don't have synchronized this object yet but it has a signature
xml_object = conduit.getXMLFromObjectWithId(document,
......@@ -674,6 +673,10 @@ class SyncMLSubscription(XMLObject):
finished = False
xml_string = signature.getFirstPdataChunk(MAX_LEN)
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(
sync_command=signature.getPartialAction(),
......
......@@ -202,9 +202,16 @@ class SyncMLAsynchronousEngine(EngineMixin):
if syncml_request.isFinal:
# Server then sends its modifications
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
# all message from client
after_method_id='processServerSynchronization',
tag = (tag, "%s_reset" % subscriber.getPath(),)
# Do not continue in elif, as sending modifications is done in the same
# package as sending notifications
if subscriber.getSynchronizationState() == "sending_modifications":
......
......@@ -437,11 +437,6 @@ class EngineMixin(object):
last_anchor=subscriber.getLastAnchor(),
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
subscriber.processSyncRequest()
else:
......
......@@ -182,6 +182,11 @@ class SyncMLSynchronousEngine(EngineMixin):
if syncml_request.isFinal:
# Server will now send its modifications
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
# package as sending notifications
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