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
Lukas Niegsch
erp5
Commits
cd193001
Commit
cd193001
authored
Jul 02, 2013
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove synchronization state from workflow
parent
0ac3057e
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
176 deletions
+137
-176
product/ERP5SyncML/Document/SyncMLSignature.py
product/ERP5SyncML/Document/SyncMLSignature.py
+27
-34
product/ERP5SyncML/Document/SyncMLSubscription.py
product/ERP5SyncML/Document/SyncMLSubscription.py
+96
-119
product/ERP5SyncML/Engine/EngineMixin.py
product/ERP5SyncML/Engine/EngineMixin.py
+3
-1
product/ERP5SyncML/tests/testERP5DocumentSyncML.py
product/ERP5SyncML/tests/testERP5DocumentSyncML.py
+2
-9
product/ERP5SyncML/tests/testERP5SyncML.py
product/ERP5SyncML/tests/testERP5SyncML.py
+9
-11
product/ERP5SyncML/tests/testERP5SyncMLVCard.py
product/ERP5SyncML/tests/testERP5SyncMLVCard.py
+0
-2
No files found.
product/ERP5SyncML/Document/SyncMLSignature.py
View file @
cd193001
...
...
@@ -37,6 +37,7 @@ from Products.ERP5Type import PropertySheet
from
Products.ERP5SyncML.Utils
import
PdataHelper
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
_MARKER
=
[]
class
SyncMLSignature
(
XMLObject
):
...
...
@@ -65,6 +66,32 @@ class SyncMLSignature(XMLObject):
,
PropertySheet
.
Document
,
PropertySheet
.
SyncMLSignature
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'synchronize'
)
def
synchronize
(
self
):
"""
This is call when subscription get confirmation of the data synchronization
This copy & reset some properties if needed
"""
edit_kw
=
{}
temporary_data
=
self
.
getTemporaryData
()
if
temporary_data
is
not
None
:
# This happens when we have sent the xml
# and we just get the confirmation
self
.
setData
(
temporary_data
)
edit_kw
[
"temporary_data"
]
=
None
if
self
.
isForce
():
edit_kw
[
"force"
]
=
False
if
self
.
hasPartialData
():
edit_kw
[
"partial_data"
]
=
None
if
self
.
hasSubscriberXupdate
():
edit_kw
[
"subscriber_xupdate"
]
=
None
if
self
.
hasPublisherXupdate
():
edit_kw
[
"publisher_xupdate"
]
=
None
if
len
(
edit_kw
):
self
.
edit
(
**
edit_kw
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setData'
)
def
setData
(
self
,
value
):
"""
...
...
@@ -248,24 +275,6 @@ class SyncMLSignature(XMLObject):
else
:
return
self
.
_baseGetPublisherXupdate
(
default
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'reset'
)
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
XXX Use a better name and a positive value by default
"""
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
()
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'getConflictList'
)
def
getConflictList
(
self
):
...
...
@@ -274,22 +283,6 @@ class SyncMLSignature(XMLObject):
"""
return
self
.
contentValues
()
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setConflictList'
)
def
setConflictList
(
self
,
conflict_list
):
"""
XXX is it still usefull ?
"""
return
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'resetConflictList'
)
def
resetConflictList
(
self
):
"""
XXX is it still usefull ?
"""
return
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'delConflict'
)
def
delConflict
(
self
,
conflict
):
...
...
product/ERP5SyncML/Document/SyncMLSubscription.py
View file @
cd193001
This diff is collapsed.
Click to expand it.
product/ERP5SyncML/Engine/EngineMixin.py
View file @
cd193001
...
...
@@ -115,7 +115,7 @@ class EngineMixin(object):
'conflict_resolved_with_merge'
):
# We will have to apply the update, and we should not care
# about conflicts, so we have to force the update
signature
.
drif
t
()
signature
.
noConflic
t
()
signature
.
setForce
(
True
)
syncml_logger
.
error
(
"
\
t
Object merged %s"
%
(
status
[
'source'
]
or
status
[
'target'
]))
...
...
@@ -125,6 +125,8 @@ class EngineMixin(object):
'conflict_resolved_with_client_command_winning'
)):
syncml_logger
.
error
(
"
\
t
Object synchronized %s"
%
(
status
[
'source'
]
or
status
[
'target'
],))
if
signature
.
getValidationState
()
!=
"no_conflict"
:
signature
.
noConflict
()
signature
.
synchronize
()
elif
status
[
'status_code'
]
==
resolveSyncmlStatusCode
(
'chunk_accepted'
):
syncml_logger
.
info
(
"Chunk was accepted for %s"
%
(
object_gid
,))
...
...
product/ERP5SyncML/tests/testERP5DocumentSyncML.py
View file @
cd193001
...
...
@@ -318,12 +318,12 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin):
for
document
in
document_server
.
objectValues
():
state_list
=
self
.
getSynchronizationState
(
document
)
for
state
in
state_list
:
self
.
assertEqual
(
state
[
1
],
'
synchronized
'
)
self
.
assertEqual
(
state
[
1
],
'
no_conflict
'
)
document_client1
=
self
.
getDocumentClient1
()
for
document
in
document_client1
.
objectValues
():
state_list
=
self
.
getSynchronizationState
(
document
)
for
state
in
state_list
:
self
.
assertEqual
(
state
[
1
],
'
synchronized
'
)
self
.
assertEqual
(
state
[
1
],
'
no_conflict
'
)
# Check for each signature that the tempXML is None
for
sub
in
portal_sync
.
contentValues
(
portal_type
=
'SyncML Subscription'
):
for
m
in
sub
.
contentValues
():
...
...
@@ -420,13 +420,7 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin):
def
getTitle
(
self
):
return
"ERP5 Document SyncML"
def
setupPublicationAndSubscriptionIdGenerator
(
self
):
portal_sync
=
self
.
getSynchronizationTool
()
sub1
=
portal_sync
[
self
.
sub_id1
]
pub
=
portal_sync
[
self
.
pub_id
]
def
checkSynchronizationStateIsConflict
(
self
,
portal_type
=
'Text'
):
portal_sync
=
self
.
getSynchronizationTool
()
document_server
=
self
.
getDocumentServer
()
for
document
in
document_server
.
objectValues
():
if
document
.
getId
()
==
self
.
id1
:
...
...
@@ -643,7 +637,6 @@ class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin):
recognize objects (because by default, getGid==getId. Here, we will see
if it also works with a somewhat strange getGid
"""
self
.
setupPublicationAndSubscriptionIdGenerator
()
nb_document
=
self
.
createDocumentServerList
()
# This will test adding object
self
.
synchronize
(
self
.
sub_id1
)
...
...
product/ERP5SyncML/tests/testERP5SyncML.py
View file @
cd193001
...
...
@@ -332,33 +332,33 @@ class TestERP5SyncMLMixin(TestMixin):
for
person
in
person_server
.
objectValues
():
state_list
=
self
.
getSynchronizationState
(
person
)
for
state
in
state_list
:
self
.
assertEquals
(
state
[
1
],
'
synchronized
'
)
self
.
assertEquals
(
state
[
1
],
'
no_conflict
'
)
person_client1
=
self
.
getPersonClient1
()
for
person
in
person_client1
.
objectValues
():
state_list
=
self
.
getSynchronizationState
(
person
)
for
state
in
state_list
:
self
.
assertEquals
(
state
[
1
],
'
synchronized
'
)
self
.
assertEquals
(
state
[
1
],
'
no_conflict
'
)
person_client2
=
self
.
getPersonClient2
()
for
person
in
person_client2
.
objectValues
():
state_list
=
self
.
getSynchronizationState
(
person
)
for
state
in
state_list
:
self
.
assertEquals
(
state
[
1
],
'
synchronized
'
)
self
.
assertEquals
(
state
[
1
],
'
no_conflict
'
)
# Check for each signature that the tempXML is None
for
sub
in
portal_sync
.
contentValues
(
portal_type
=
'SyncML Subscription'
):
for
m
in
sub
.
contentValues
():
self
.
assertEquals
(
m
.
getTemporaryData
(),
None
)
self
.
assertEquals
(
m
.
getPartialData
(),
None
)
self
.
assertEquals
(
m
.
getValidationState
(),
"
synchronized
"
)
self
.
assertEquals
(
m
.
getValidationState
(),
"
no_conflict
"
)
for
pub
in
portal_sync
.
contentValues
(
portal_type
=
'SyncML Publication'
):
for
sub
in
pub
.
contentValues
(
portal_type
=
'SyncML Subscription'
):
for
m
in
sub
.
contentValues
():
self
.
assertEquals
(
m
.
getPartialData
(),
None
)
self
.
assertEquals
(
m
.
getValidationState
(),
"
synchronized
"
)
self
.
assertEquals
(
m
.
getValidationState
(),
"
no_conflict
"
)
def
verifyFirstNameAndLastNameAreNotSynchronized
(
self
,
first_name
,
last_name
,
person_server
,
person_client
):
"""
verify that the first and last name are NOT
synchronized
verify that the first and last name are NOT
no_conflict
"""
self
.
assertNotEqual
(
person_server
.
getFirstName
(),
first_name
)
self
.
assertNotEqual
(
person_server
.
getLastName
(),
last_name
)
...
...
@@ -484,7 +484,6 @@ class TestERP5SyncML(TestERP5SyncMLMixin):
pub
.
setConduitModuleId
(
'ERP5ConduitTitleGid'
)
def
checkSynchronizationStateIsConflict
(
self
):
portal_sync
=
self
.
getSynchronizationTool
()
person_server
=
self
.
getPersonServer
()
for
person
in
person_server
.
objectValues
():
if
person
.
getId
()
==
self
.
id1
:
...
...
@@ -754,7 +753,6 @@ return [context[%r]]
# We will try to get the state of objects
# that are just synchronized
self
.
test_08_FirstSynchronization
()
portal_sync
=
self
.
getSynchronizationTool
()
person_server
=
self
.
getPersonServer
()
person1_s
=
person_server
.
_getOb
(
self
.
id1
)
state_list_s
=
self
.
getSynchronizationState
(
person1_s
)
...
...
@@ -785,6 +783,8 @@ return [context[%r]]
kw
=
{
'first_name'
:
self
.
first_name1
,
'last_name'
:
self
.
last_name1
}
person1_c
.
edit
(
**
kw
)
#person1_c.setModificationDate(DateTime()+1)
# import ipdb
# ipdb.set_trace()
self
.
synchronize
(
self
.
sub_id1
)
self
.
checkSynchronizationStateIsSynchronized
()
person1_s
=
person_server
.
_getOb
(
self
.
id1
)
...
...
@@ -951,8 +951,6 @@ return [context[%r]]
person_server
.
manage_delObjects
(
self
.
id1
)
person_client1
=
self
.
getPersonClient1
()
person_client1
.
manage_delObjects
(
self
.
id2
)
# import ipdb
# ipdb.set_trace()
self
.
synchronize
(
self
.
sub_id1
)
self
.
synchronize
(
self
.
sub_id2
)
self
.
checkSynchronizationStateIsSynchronized
()
...
...
@@ -1601,7 +1599,7 @@ return [context[%r]]
publication
=
self
.
addPublication
()
self
.
addRefreshFormClientOnlySubscription
()
nb_person
=
self
.
populatePersonClient1
()
self
.
populatePersonClient1
()
portal_sync
=
self
.
getSynchronizationTool
()
subscription1
=
portal_sync
[
self
.
sub_id1
]
self
.
assertEquals
(
subscription1
.
getSyncmlAlertCode
(),
...
...
product/ERP5SyncML/tests/testERP5SyncMLVCard.py
View file @
cd193001
...
...
@@ -28,9 +28,7 @@
#
##############################################################################
from
testERP5SyncML
import
TestERP5SyncMLMixin
from
zLOG
import
LOG
class
TestERP5SyncMLVCard
(
TestERP5SyncMLMixin
):
...
...
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