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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
5a4407f0
Commit
5a4407f0
authored
Mar 05, 2013
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use generic recursiveCallMethod to implement reset of signature
Thanks to vincent for notifying
parent
cc1c0d84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
42 deletions
+18
-42
product/ERP5SyncML/Document/SyncMLSignature.py
product/ERP5SyncML/Document/SyncMLSignature.py
+12
-3
product/ERP5SyncML/Document/SyncMLSubscription.py
product/ERP5SyncML/Document/SyncMLSubscription.py
+5
-37
product/ERP5SyncML/Engine/EngineMixin.py
product/ERP5SyncML/Engine/EngineMixin.py
+1
-2
No files found.
product/ERP5SyncML/Document/SyncMLSignature.py
View file @
5a4407f0
...
...
@@ -284,9 +284,18 @@ class SyncMLSignature(XMLObject):
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'reset'
)
def
reset
(
self
):
"""Clear Signature and change validation_state to not_synchronized
"""
def
reset
(
self
,
no_conflict
=
False
):
"""
Clear Signature and change validation_state to not_synchronized
no_conflict : prevent the reset of signature for which conflict
has not been marked resolved, this is usefull when
resetting all signature at the beginning of a sync process
"""
if
no_conflict
and
self
.
getValidationState
()
in
(
'conflict'
,
'conflict_resolved_with_merge'
,
'conflict_resolved_with_client_command_winning'
):
return
if
self
.
getValidationState
()
!=
'not_synchronized'
:
self
.
drift
()
self
.
setPartialData
(
None
)
...
...
product/ERP5SyncML/Document/SyncMLSubscription.py
View file @
5a4407f0
...
...
@@ -991,46 +991,14 @@ class SyncMLSubscription(XMLObject):
'conflict_resolved_with_client_command_winning'
):
signature
.
reset
()
def
_resetSignatureIDList
(
self
,
signature_id_list
):
"""
Reset a list of signature given by their ids
"""
for
signature_id
in
signature_id_list
:
signature
=
self
[
signature_id
]
if
signature
.
getValidationState
()
not
in
(
'conflict'
,
'conflict_resolved_with_merge'
,
'conflict_resolved_with_client_command_winning'
):
signature
.
reset
()
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'getAndActivateResetSignature'
)
def
getAndActivateResetSignature
(
self
,
min_packet_id
=
0
):
"""
Reset signature by packet (i.e. getAndActivate)
"""
activate_kw
=
{
"activity"
:
"SQLQueue"
,
"priority"
:
ACTIVITY_PRIORITY
}
packet_size
=
30
limit
=
packet_size
*
100
activate
=
self
.
activate
callback_method
=
getattr
(
activate
(
**
activate_kw
),
"_resetSignatureIDList"
)
signature_id_list
=
self
.
objectIds
()
id_length
=
len
(
self
)
# Either there will be remaining id, either this is the end
max_packet
=
min
(
min_packet_id
+
limit
,
len
(
self
))
for
i
in
xrange
(
min_packet_id
,
max_packet
,
packet_size
):
# syncml_logger.info("getAndActivateResetSignature : call callback method")
callback_method
(
signature_id_list
=
list
(
signature_id_list
[
i
:
i
+
packet_size
]))
min_packet_id
+=
limit
# Next point to start to read the id_list
if
id_length
>
min_packet_id
:
# syncml_logger.info("getAndActivateResetSignature : calling itself recursively %s"
# % (min_packet_id))
activate
(
activity
=
"SQLQueue"
,
priority
=
ACTIVITY_PRIORITY
+
1
).
getAndActivateResetSignature
(
min_packet_id
=
min_packet_id
)
self
.
recurseCallMethod
(
method_id
=
"reset"
,
method_kw
=
{
"no_conflict"
:
True
},
min_depth
=
1
,
max_depth
=
1
,
activate_kw
=
{
'priority'
:
ACTIVITY_PRIORITY
})
product/ERP5SyncML/Engine/EngineMixin.py
View file @
5a4407f0
...
...
@@ -454,8 +454,7 @@ class EngineMixin(object):
subscriber
.
activate
(
activity
=
"SQLQueue"
,
after_method_id_list
=
(
"reset"
,
"getAndActivateResetSignature"
,
"_resetSignatureIDList"
),
"_recurseCallMethod"
),
# Wait for all reset to be done
# before starting sync
priority
=
ACTIVITY_PRIORITY
,
...
...
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