Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexander Emmerich
erp5
Commits
dce9bcd2
Commit
dce9bcd2
authored
Jul 01, 2013
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement deletion checking using SQL
parent
bda033fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
42 deletions
+46
-42
product/ERP5SyncML/Document/SyncMLSubscription.py
product/ERP5SyncML/Document/SyncMLSubscription.py
+38
-35
product/ERP5SyncML/Engine/AsynchronousEngine.py
product/ERP5SyncML/Engine/AsynchronousEngine.py
+6
-2
product/ERP5SyncML/Engine/SynchronousEngine.py
product/ERP5SyncML/Engine/SynchronousEngine.py
+2
-5
No files found.
product/ERP5SyncML/Document/SyncMLSubscription.py
View file @
dce9bcd2
...
...
@@ -220,7 +220,6 @@ class SyncMLSubscription(XMLObject):
# Build Message
if response_message_id:
syncml_response = self.generateBaseResponse()
syncml_response.addBody()
else:
syncml_response = None
...
...
@@ -637,7 +636,6 @@ class SyncMLSubscription(XMLObject):
the "
sending_modification
" stage of the synchronization
"""
syncml_response = self.generateBaseResponse()
syncml_response.addBody()
syncml_response.addFinal()
final_activate_kw = {
...
...
@@ -651,6 +649,37 @@ class SyncMLSubscription(XMLObject):
self.activate(**final_activate_kw).sendMessage(xml=str(syncml_response))
def getDeletedSyncMLData(self, syncml_response=None):
"""
Retrieve & generate the syncml message for messages that were deleted
This message also contains the final tag to let know that the sending
of modification is over
"""
if not syncml_response:
syncml_response = self.generateBaseResponse()
# Compare gid between signature & source to know which data were deleted
deleted_signature_set = self.z_get_syncml_deleted_gid_list(
signature_path=self.getSearchablePath(),
source_path=self.getSearchableSourcePath())
syncml_logger.info("
\
t
--->
delete
signature
are
%
r" % (len(deleted_signature_set)))
for r in deleted_signature_set:
syncml_response.addDeleteCommand(gid=r.gid)
syncml_logger.info("
\
t
\
t
--->
%
r" % (r.gid))
syncml_response.addFinal()
# Now send the message
final_activate_kw = {
'after_method_id' : ("
processServerSynchronization
",
"
processClientSynchronization
"),
'priority' :ACTIVITY_PRIORITY + 1,
'tag' : "
%
s_delete
" %(self.getRelativeUrl(),)
}
syncml_logger.info("
Sending
final
message
for
modificationson
on
%
s
"
% (self.getRelativeUrl(),))
self.activate(**final_activate_kw).sendMessage(xml=str(syncml_response))
def getSearchablePath(self):
return "
%
s
%%
" %(self.getPath().replace('_', '
\
_
'
),)
...
...
@@ -668,40 +697,13 @@ class SyncMLSubscription(XMLObject):
finished = True
conduit = self.getConduit()
portal = self.getPortalObject()
traverse = portal.restrictedTraverse
# Compare gid list to know which data were deleted
source_gid_list = [x.gid for x in self.z_get_syncml_gid_list(
strict_min_gid=None,
min_gid=min_gid,
max_gid=max_gid,
path =self.getSearchableSourcePath(),
limit=None)]
# Check deletion now ?
if portal.portal_preferences.getPreferredCheckDeleteAtEnd() is False:
raise NotImplementedError
src = self.z_get_syncml_gid_list(
src__=1,
strict_min_gid=None,
min_gid=min_gid,
max_gid=max_gid,
path = self.getSearchablePath(),
limit=None)
syncml_logger.info("
source
%
r" % (src,))
signature_list = [x.gid for x in self.z_get_syncml_gid_list(
strict_min_gid=None,
min_gid=min_gid,
max_gid=max_gid,
path = self.getSearchablePath(),
limit=None)]
signature_set = set(signature_list)
source_gid_set = set(source_gid_list) # XXX get it with mysql
deleted_signature_set = signature_set - source_gid_set
syncml_logger.info("
\
t
--->
delete
signature
are
%
r
from
%
r
-
%
r"
% (deleted_signature_set, signature_set, source_gid_set))
for gid in deleted_signature_set:
syncml_response.addDeleteCommand(gid=gid)
traverse = self.getPortalObject().restrictedTraverse
object_list = [traverse(x.path) for x in self.z_get_syncml_path_list(
min_gid=min_gid,
max_gid=max_gid,
...
...
@@ -1170,7 +1172,6 @@ class SyncMLSubscription(XMLObject):
conflict_list.extend(signature.getConflictList())
return conflict_list
security.declareProtected(Permissions.ModifyPortalContent,
'indexSourceData')
def indexSourceData(self, client=False):
...
...
@@ -1178,6 +1179,8 @@ class SyncMLSubscription(XMLObject):
Index source data into mysql for ensemble comparison
This depends on synchronization type
"""
# XXX Must check & index signature also (check lenght of BTree against
# lenght of data in sql
if (client and self.getSyncmlAlertCode() not in
\
("
one_way_from_server
", "
refresh_from_server_only
")) or
\
(not client and self.getSyncmlAlertCode() not in
\
...
...
product/ERP5SyncML/Engine/AsynchronousEngine.py
View file @
dce9bcd2
...
...
@@ -261,8 +261,12 @@ class SyncMLAsynchronousEngine(EngineMixin):
activity_count
=
pref
.
getPreferredRetrievalActivityCount
(),
)
# then send the final message of this sync part
subscription
.
activate
(
after_tag
=
tag
,
priority
=
ACTIVITY_PRIORITY
+
1
).
_sendFinalMessage
()
if
pref
.
getPreferredCheckDeleteAtEnd
():
subscription
.
activate
(
after_tag
=
tag
,
priority
=
ACTIVITY_PRIORITY
+
1
).
getDeletedSyncMLData
()
else
:
subscription
.
activate
(
after_tag
=
tag
,
priority
=
ACTIVITY_PRIORITY
+
1
).
_sendFinalMessage
()
return
True
...
...
product/ERP5SyncML/Engine/SynchronousEngine.py
View file @
dce9bcd2
...
...
@@ -86,9 +86,7 @@ class SyncMLSynchronousEngine(EngineMixin):
syncml_logger
.
info
(
"-> Client sendind modification, finished %s"
%
(
finished
,))
if
finished
:
# Add deleted objets
#subscription._getDeletedData(syncml_response=syncml_response)
# Notify that all modifications were sent
syncml_response
.
addFinal
()
subscription
.
getDeletedSyncMLData
(
syncml_response
=
syncml_response
)
# Will then start processing sync commands from server
subscription
.
processSyncRequest
()
...
...
@@ -207,8 +205,7 @@ class SyncMLSynchronousEngine(EngineMixin):
min_gid
=
None
,
max_gid
=
None
)
syncml_logger
.
info
(
"-> Server sendind data, finished %s"
%
(
finished
,))
if
finished
:
#subscriber._getDeletedData(syncml_response=syncml_response)
syncml_response
.
addFinal
()
subscriber
.
getDeletedSyncMLData
(
syncml_response
=
syncml_response
)
subscriber
.
waitNotifications
()
# Do not go into finished here as we must wait for
# notifications from client
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment