Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
2f7d0ece
Commit
2f7d0ece
authored
Oct 13, 2011
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix unicode errors & do some cleanup
parent
8b7fde47
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
20 deletions
+26
-20
bt5/erp5_tiosafe_oxatis_test/TestTemplateItem/testOxatisSynchronization.py
...oxatis_test/TestTemplateItem/testOxatisSynchronization.py
+6
-6
product/ERP5SyncML/Document/SyncMLSignature.py
product/ERP5SyncML/Document/SyncMLSignature.py
+2
-0
product/ERP5SyncML/Tool/SynchronizationTool.py
product/ERP5SyncML/Tool/SynchronizationTool.py
+5
-3
product/ERP5TioSafe/Conduit/AccountERP5IntegrationConduit.py
product/ERP5TioSafe/Conduit/AccountERP5IntegrationConduit.py
+0
-1
product/ERP5TioSafe/Conduit/TioSafeBaseConduit.py
product/ERP5TioSafe/Conduit/TioSafeBaseConduit.py
+8
-4
product/ERP5TioSafe/Conduit/TioSafeNodeConduit.py
product/ERP5TioSafe/Conduit/TioSafeNodeConduit.py
+5
-6
No files found.
bt5/erp5_tiosafe_oxatis_test/TestTemplateItem/testOxatisSynchronization.py
View file @
2f7d0ece
...
@@ -32,7 +32,7 @@ import unittest
...
@@ -32,7 +32,7 @@ import unittest
from
zLOG
import
LOG
from
zLOG
import
LOG
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
import
os
class
TestOxatisSynchronization
(
ERP5TypeTestCase
):
class
TestOxatisSynchronization
(
ERP5TypeTestCase
):
"""
"""
...
@@ -66,7 +66,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
...
@@ -66,7 +66,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
"""
"""
self
.
portal
=
self
.
getPortal
()
self
.
portal
=
self
.
getPortal
()
self
.
oxatis
=
self
.
portal
.
portal_integrations
.
oxatis
self
.
oxatis
=
self
.
portal
.
portal_integrations
.
oxatis
# Create a user for sync
# Create a user for sync
acl_users
=
self
.
portal
.
acl_users
acl_users
=
self
.
portal
.
acl_users
acl_users
.
_doAddUser
(
'TioSafeUser'
,
'TioSafeUserPassword'
,
[
'Manager'
],
[])
acl_users
.
_doAddUser
(
'TioSafeUser'
,
'TioSafeUserPassword'
,
[
'Manager'
],
[])
...
@@ -85,7 +85,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
...
@@ -85,7 +85,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
self
.
oxatis
.
getResourceValue
().
validate
()
self
.
oxatis
.
getResourceValue
().
validate
()
self
.
default_resource_id
=
self
.
oxatis
.
getResourceValue
().
getId
()
self
.
default_resource_id
=
self
.
oxatis
.
getResourceValue
().
getId
()
self
.
default_source_id
=
self
.
oxatis
.
getSourceAdministrationValue
().
getId
()
self
.
default_source_id
=
self
.
oxatis
.
getSourceAdministrationValue
().
getId
()
for
connector
in
self
.
oxatis
.
contentValues
(
portal_type
=
"Web Service Connector"
):
for
connector
in
self
.
oxatis
.
contentValues
(
portal_type
=
"Web Service Connector"
):
# use the test connector
# use the test connector
connector
.
setTransport
(
"oxatis_test"
)
connector
.
setTransport
(
"oxatis_test"
)
...
@@ -147,7 +147,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
...
@@ -147,7 +147,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
diff
+=
"%s
\
n
"
%
(
line
)
diff
+=
"%s
\
n
"
%
(
line
)
raise
AssertionError
,
diff
raise
AssertionError
,
diff
def
checkConflicts
(
self
,
module
,
nb_pub_conflicts
=
0
,
nb_sub_conflicts
=
0
,
in_conflict
=
True
):
def
checkConflicts
(
self
,
module
,
nb_pub_conflicts
=
0
,
nb_sub_conflicts
=
0
,
in_conflict
=
True
):
module
=
self
.
oxatis
[
module
]
module
=
self
.
oxatis
[
module
]
...
@@ -190,7 +190,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
...
@@ -190,7 +190,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
if
document
.
getTitle
()
not
in
excluded_title_list
:
if
document
.
getTitle
()
not
in
excluded_title_list
:
self
.
assertEqual
(
len
([
x
for
x
in
document
.
Base_getRelatedObjectList
()
if
x
.
getPortalType
()
==
"Sale Trade Condition"
]),
1
)
self
.
assertEqual
(
len
([
x
for
x
in
document
.
Base_getRelatedObjectList
()
if
x
.
getPortalType
()
==
"Sale Trade Condition"
]),
1
)
else
:
else
:
self
.
assertEqual
(
len
([
x
for
x
in
document
.
Base_getRelatedObjectList
()
if
x
.
getPortalType
()
==
"Sale Trade Condition"
]),
0
)
self
.
assertEqual
(
len
([
x
for
x
in
document
.
Base_getRelatedObjectList
()
if
x
.
getPortalType
()
==
"Sale Trade Condition"
]),
0
)
def
runPersonSync
(
self
):
def
runPersonSync
(
self
):
"""
"""
...
@@ -371,7 +371,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
...
@@ -371,7 +371,7 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
#
#
# Modify person on both side
# Modify person on both side
#
#
for
person
in
self
.
portal
.
person_module
.
searchFolder
(
validation_state
=
"validated"
):
for
person
in
self
.
portal
.
person_module
.
searchFolder
(
validation_state
=
"validated"
):
if
person
.
getTitle
()
==
"test-Aurélien Calonne"
:
if
person
.
getTitle
()
==
"test-Aurélien Calonne"
:
...
...
product/ERP5SyncML/Document/SyncMLSignature.py
View file @
2f7d0ece
...
@@ -132,6 +132,8 @@ class SyncMLSignature(XMLObject):
...
@@ -132,6 +132,8 @@ class SyncMLSignature(XMLObject):
if we want to know if an objects has changed or not
if we want to know if an objects has changed or not
Returns 1 if MD5 are equals, else it returns 0
Returns 1 if MD5 are equals, else it returns 0
"""
"""
if
isinstance
(
xml_string
,
unicode
):
xml_string
=
xml_string
.
encode
(
'utf-8'
)
return
((
md5
.
new
(
xml_string
).
hexdigest
())
==
self
.
getContentMd5
())
return
((
md5
.
new
(
xml_string
).
hexdigest
())
==
self
.
getContentMd5
())
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setPartialData'
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setPartialData'
)
...
...
product/ERP5SyncML/Tool/SynchronizationTool.py
View file @
2f7d0ece
...
@@ -2165,18 +2165,20 @@ class SynchronizationTool(BaseTool):
...
@@ -2165,18 +2165,20 @@ class SynchronizationTool(BaseTool):
if
reset
:
if
reset
:
#After a reset we want copy the LAST XML view on Signature.
#After a reset we want copy the LAST XML view on Signature.
#this implementation is not sufficient, need to be improved.
#this implementation is not sufficient, need to be improved.
if
not
isinstance
(
xml_object
,
str
):
if
not
isinstance
(
xml_object
,
(
str
,
unicode
)
):
xml_object
=
etree
.
tostring
(
xml_object
,
encoding
=
'utf-8'
,
xml_object
=
etree
.
tostring
(
xml_object
,
encoding
=
'utf-8'
,
pretty_print
=
True
)
pretty_print
=
True
)
else
:
else
:
xml_object
=
conduit
.
getXMLFromObjectWithId
(
object
,
xml_object
=
conduit
.
getXMLFromObjectWithId
(
object
,
xml_mapping
=
\
xml_mapping
=
\
domain
.
getXmlBindingGeneratorMethodId
(),
domain
.
getXmlBindingGeneratorMethodId
(),
context_document
=
subscriber
.
getPath
())
context_document
=
subscriber
.
getPath
())
#if signature.getValidationState() != 'synchronized':
#if signature.getValidationState() != 'synchronized':
if
isinstance
(
xml_object
,
unicode
):
xml_object
=
xml_object
.
encode
(
'utf-8'
)
signature
.
synchronize
()
signature
.
synchronize
()
signature
.
setReference
(
object
.
getPath
())
signature
.
setReference
(
object
.
getPath
())
signature
.
setData
(
xml_object
)
signature
.
setData
(
str
(
xml_object
)
)
xml_confirmation_list
.
append
(
self
.
SyncMLConfirmation
(
xml_confirmation_list
.
append
(
self
.
SyncMLConfirmation
(
cmd_id
=
cmd_id
,
cmd_id
=
cmd_id
,
cmd
=
'Add'
,
cmd
=
'Add'
,
...
...
product/ERP5TioSafe/Conduit/AccountERP5IntegrationConduit.py
View file @
2f7d0ece
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
##############################################################################
##############################################################################
from
Products.ERP5TioSafe.Conduit.TioSafeBaseConduit
import
TioSafeBaseConduit
from
Products.ERP5TioSafe.Conduit.TioSafeBaseConduit
import
TioSafeBaseConduit
from
lxml
import
etree
class
AccountERP5IntegrationConduit
(
TioSafeBaseConduit
):
class
AccountERP5IntegrationConduit
(
TioSafeBaseConduit
):
"""
"""
...
...
product/ERP5TioSafe/Conduit/TioSafeBaseConduit.py
View file @
2f7d0ece
...
@@ -51,20 +51,24 @@ class TioSafeBaseConduit(ERP5Conduit):
...
@@ -51,20 +51,24 @@ class TioSafeBaseConduit(ERP5Conduit):
XXX name of method is not good, because content is not necessarily XML
XXX name of method is not good, because content is not necessarily XML
return a xml with id replaced by a new id
return a xml with id replaced by a new id
"""
"""
if
isinstance
(
xml
,
str
):
if
isinstance
(
xml
,
str
)
or
isinstance
(
xml
,
unicode
)
:
xml
=
etree
.
XML
(
xml
,
parser
=
parser
)
xml
=
etree
.
XML
(
str
(
xml
)
,
parser
=
parser
)
else
:
else
:
# copy of xml object for modification
# copy of xml object for modification
xml
=
deepcopy
(
xml
)
xml
=
deepcopy
(
xml
)
object_element
=
xml
.
find
(
'object'
)
object_element
=
xml
.
find
(
'object'
)
if
object_element
:
if
object_element
and
object_element
!=
-
1
:
if
attribute_name
==
'id'
:
if
attribute_name
==
'id'
:
del
object_element
.
attrib
[
'gid'
]
del
object_element
.
attrib
[
'gid'
]
else
:
else
:
del
object_element
.
attrib
[
'id'
]
del
object_element
.
attrib
[
'id'
]
object_element
.
attrib
[
attribute_name
]
=
new_id
object_element
.
attrib
[
attribute_name
]
=
new_id
if
as_string
:
if
as_string
:
return
etree
.
tostring
(
xml
,
pretty_print
=
True
,
encoding
=
"utf-8"
)
try
:
return
etree
.
tostring
(
xml
,
pretty_print
=
True
,
encoding
=
"utf-8"
)
except
:
import
pdb
pdb
.
set_trace
()
return
xml
return
xml
def
_generateConflict
(
self
,
path
,
tag
,
xml
,
current_value
,
new_value
,
signature
):
def
_generateConflict
(
self
,
path
,
tag
,
xml
,
current_value
,
new_value
,
signature
):
...
...
product/ERP5TioSafe/Conduit/TioSafeNodeConduit.py
View file @
2f7d0ece
# -*- coding: utf-8 -*-
##############################################################################
##############################################################################
#
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Herv
é
Poulain <herve@nexedi.com>
# Herv
é
Poulain <herve@nexedi.com>
#
#
# WARNING: This program as such is intended to be used by professional
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# programmers who take the whole responsability of assessing all potential
...
@@ -27,7 +28,7 @@
...
@@ -27,7 +28,7 @@
##############################################################################
##############################################################################
from
Products.ERP5TioSafe.Conduit.TioSafeBaseConduit
import
TioSafeBaseConduit
from
Products.ERP5TioSafe.Conduit.TioSafeBaseConduit
import
TioSafeBaseConduit
from
lxml
import
etree
class
TioSafeNodeConduit
(
TioSafeBaseConduit
):
class
TioSafeNodeConduit
(
TioSafeBaseConduit
):
"""
"""
...
@@ -205,7 +206,7 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
...
@@ -205,7 +206,7 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
# value = DateTime(value).strftime(format)
# value = DateTime(value).strftime(format)
keyword
=
{
'person_id'
:
document
.
getId
(),
tag
:
value
,
}
keyword
=
{
'person_id'
:
document
.
getId
(),
tag
:
value
,
}
document
.
context
.
person_module
.
updatePerson
(
**
keyword
)
document
.
context
.
person_module
.
updatePerson
(
**
keyword
)
new_document
=
document
.
context
.
person_module
[
document
.
getId
()]
new_document
=
document
.
context
.
person_module
[
document
.
getId
()]
document
.
updateProperties
(
new_document
)
document
.
updateProperties
(
new_document
)
return
conflict_list
return
conflict_list
...
@@ -364,10 +365,8 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
...
@@ -364,10 +365,8 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
# value = DateTime(value).strftime(format)
# value = DateTime(value).strftime(format)
keyword
=
{
'person_id'
:
document
.
getId
(),
tag
:
value
,
}
keyword
=
{
'person_id'
:
document
.
getId
(),
tag
:
value
,
}
document
.
context
.
person_module
.
updatePerson
(
**
keyword
)
document
.
context
.
person_module
.
updatePerson
(
**
keyword
)
new_document
=
document
.
context
.
person_module
[
document
.
getId
()]
new_document
=
document
.
context
.
person_module
[
document
.
getId
()]
document
.
updateProperties
(
new_document
)
document
.
updateProperties
(
new_document
)
return
conflict_list
return
conflict_list
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