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
Binh
erp5
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
Show 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
from
zLOG
import
LOG
from
Testing
import
ZopeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
import
os
class
TestOxatisSynchronization
(
ERP5TypeTestCase
):
"""
...
...
product/ERP5SyncML/Document/SyncMLSignature.py
View file @
2f7d0ece
...
...
@@ -132,6 +132,8 @@ class SyncMLSignature(XMLObject):
if we want to know if an objects has changed or not
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
())
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setPartialData'
)
...
...
product/ERP5SyncML/Tool/SynchronizationTool.py
View file @
2f7d0ece
...
...
@@ -2165,7 +2165,7 @@ class SynchronizationTool(BaseTool):
if
reset
:
#After a reset we want copy the LAST XML view on Signature.
#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'
,
pretty_print
=
True
)
else
:
...
...
@@ -2174,9 +2174,11 @@ class SynchronizationTool(BaseTool):
domain
.
getXmlBindingGeneratorMethodId
(),
context_document
=
subscriber
.
getPath
())
#if signature.getValidationState() != 'synchronized':
if
isinstance
(
xml_object
,
unicode
):
xml_object
=
xml_object
.
encode
(
'utf-8'
)
signature
.
synchronize
()
signature
.
setReference
(
object
.
getPath
())
signature
.
setData
(
xml_object
)
signature
.
setData
(
str
(
xml_object
)
)
xml_confirmation_list
.
append
(
self
.
SyncMLConfirmation
(
cmd_id
=
cmd_id
,
cmd
=
'Add'
,
...
...
product/ERP5TioSafe/Conduit/AccountERP5IntegrationConduit.py
View file @
2f7d0ece
...
...
@@ -26,7 +26,6 @@
##############################################################################
from
Products.ERP5TioSafe.Conduit.TioSafeBaseConduit
import
TioSafeBaseConduit
from
lxml
import
etree
class
AccountERP5IntegrationConduit
(
TioSafeBaseConduit
):
"""
...
...
product/ERP5TioSafe/Conduit/TioSafeBaseConduit.py
View file @
2f7d0ece
...
...
@@ -51,20 +51,24 @@ class TioSafeBaseConduit(ERP5Conduit):
XXX name of method is not good, because content is not necessarily XML
return a xml with id replaced by a new id
"""
if
isinstance
(
xml
,
str
):
xml
=
etree
.
XML
(
xml
,
parser
=
parser
)
if
isinstance
(
xml
,
str
)
or
isinstance
(
xml
,
unicode
)
:
xml
=
etree
.
XML
(
str
(
xml
)
,
parser
=
parser
)
else
:
# copy of xml object for modification
xml
=
deepcopy
(
xml
)
object_element
=
xml
.
find
(
'object'
)
if
object_element
:
if
object_element
and
object_element
!=
-
1
:
if
attribute_name
==
'id'
:
del
object_element
.
attrib
[
'gid'
]
else
:
del
object_element
.
attrib
[
'id'
]
object_element
.
attrib
[
attribute_name
]
=
new_id
if
as_string
:
try
:
return
etree
.
tostring
(
xml
,
pretty_print
=
True
,
encoding
=
"utf-8"
)
except
:
import
pdb
pdb
.
set_trace
()
return
xml
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.
# Herv
é
Poulain <herve@nexedi.com>
# Herv
é
Poulain <herve@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
...
...
@@ -27,7 +28,7 @@
##############################################################################
from
Products.ERP5TioSafe.Conduit.TioSafeBaseConduit
import
TioSafeBaseConduit
from
lxml
import
etree
class
TioSafeNodeConduit
(
TioSafeBaseConduit
):
"""
...
...
@@ -369,5 +370,3 @@ class TioSafeNodeConduit(TioSafeBaseConduit):
new_document
=
document
.
context
.
person_module
[
document
.
getId
()]
document
.
updateProperties
(
new_document
)
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