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
Labels
Merge Requests
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
c551be23
Commit
c551be23
authored
Apr 21, 2024
by
Jérome Perrin
Committed by
Arnaud Fontaine
Jul 31, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syncml: pylint for py3
parent
fafeb5cb
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
105 additions
and
110 deletions
+105
-110
bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSubscription.py
...tem/portal_components/document.erp5.SyncMLSubscription.py
+1
-1
bt5/erp5_syncml/MixinTemplateItem/portal_components/mixin.erp5.SyncMLEngineMixin.py
...ateItem/portal_components/mixin.erp5.SyncMLEngineMixin.py
+4
-5
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.BaseConduit.py
...TemplateItem/portal_components/module.erp5.BaseConduit.py
+0
-1
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5Conduit.py
...TemplateItem/portal_components/module.erp5.ERP5Conduit.py
+3
-5
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLEngineAsynchronous.py
...portal_components/module.erp5.SyncMLEngineAsynchronous.py
+1
-1
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLMessage.py
...mplateItem/portal_components/module.erp5.SyncMLMessage.py
+88
-90
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py
...Item/portal_components/module.erp5.SyncMLTransportFile.py
+2
-2
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportHTTP.py
...Item/portal_components/module.erp5.SyncMLTransportHTTP.py
+1
-1
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportMail.py
...Item/portal_components/module.erp5.SyncMLTransportMail.py
+2
-2
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.VCardConduit.py
...emplateItem/portal_components/module.erp5.VCardConduit.py
+1
-1
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XupdateUtils.py
...emplateItem/portal_components/module.erp5.XupdateUtils.py
+2
-1
No files found.
bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSubscription.py
View file @
c551be23
...
@@ -541,7 +541,7 @@ class SyncMLSubscription(XMLObject):
...
@@ -541,7 +541,7 @@ class SyncMLSubscription(XMLObject):
xml_document = etree.tostring(xml_document, encoding='utf-8',
xml_document = etree.tostring(xml_document, encoding='utf-8',
pretty_print=True)
pretty_print=True)
if six.PY2 and isinstance(xml_document,
unicod
e):
if six.PY2 and isinstance(xml_document,
six.text_typ
e):
xml_document = xml_document.encode('utf-8')
xml_document = xml_document.encode('utf-8')
# Link the signature to the document
# Link the signature to the document
if signature:
if signature:
...
...
bt5/erp5_syncml/MixinTemplateItem/portal_components/mixin.erp5.SyncMLEngineMixin.py
View file @
c551be23
...
@@ -76,11 +76,10 @@ class SyncMLEngineMixin(object):
...
@@ -76,11 +76,10 @@ class SyncMLEngineMixin(object):
status
[
'authentication_type'
]))
status
[
'authentication_type'
]))
# XXX Not working To Review !
# XXX Not working To Review !
raise
NotImplementedError
(
"Adding credentials"
)
raise
NotImplementedError
(
"Adding credentials"
)
"""
# syncml_response = domain.generateBaseResponse()
syncml_response = domain.generateBaseResponse()
# syncml_response.addCredentialMessage(domain)
syncml_response.addCredentialMessage(domain)
# return syncml_response
return syncml_response
"""
elif
status
[
'status_code'
]
==
\
elif
status
[
'status_code'
]
==
\
resolveSyncmlStatusCode
(
'invalid_credentials'
):
resolveSyncmlStatusCode
(
'invalid_credentials'
):
syncml_logger
.
error
(
"
\
t
Client authentication refused"
)
syncml_logger
.
error
(
"
\
t
Client authentication refused"
)
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.BaseConduit.py
View file @
c551be23
...
@@ -92,5 +92,4 @@ class BaseConduit(object):
...
@@ -92,5 +92,4 @@ class BaseConduit(object):
Method called when update command is received
Method called when update command is received
XXX It should returns the list of conflicts ?
XXX It should returns the list of conflicts ?
"""
"""
pass
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.ERP5Conduit.py
View file @
c551be23
...
@@ -490,9 +490,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
...
@@ -490,9 +490,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
first_object = False
first_object = False
elif sub_context is not None:
elif sub_context is not None:
context = sub_context
context = sub_context
else:
#
else:
# Ignore non existing objects
# Ignore non existing objects
pass
#LOG('ERP5Conduit', INFO, 'sub document of %s not found with id:%r'%
\
#LOG('ERP5Conduit', INFO, 'sub document of %s not found with id:%r'%
\
#(context.getPath(), sub_context_id))
#(context.getPath(), sub_context_id))
xpath = xpath.replace(object_block, '', 1)
xpath = xpath.replace(object_block, '', 1)
...
@@ -695,7 +694,6 @@ class ERP5Conduit(XMLSyncUtilsMixin):
...
@@ -695,7 +694,6 @@ class ERP5Conduit(XMLSyncUtilsMixin):
def afterNewObject(self, object): # pylint: disable=redefined-builtin
def afterNewObject(self, object): # pylint: disable=redefined-builtin
"""
Overloadable
method
"""
Overloadable
method
"""
"""
pass
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getStatusFromXml')
'getStatusFromXml')
...
@@ -856,7 +854,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
...
@@ -856,7 +854,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if xupdated_node_list:
if xupdated_node_list:
xupdated_node = xupdated_node_list[0]
xupdated_node = xupdated_node_list[0]
else:
else:
ValueError('Wrong xpath expression:%r' % base_xpath_expression)
raise
ValueError('Wrong xpath expression:%r' % base_xpath_expression)
if base_xpath_expression not in xpath_expression_update_dict:
if base_xpath_expression not in xpath_expression_update_dict:
xpath_expression_update_dict[base_xpath_expression] =
\
xpath_expression_update_dict[base_xpath_expression] =
\
dict(xml=xupdated_node,
dict(xml=xupdated_node,
...
@@ -876,7 +874,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
...
@@ -876,7 +874,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if xupdated_node_list:
if xupdated_node_list:
xupdated_node = xupdated_node_list[0]
xupdated_node = xupdated_node_list[0]
else:
else:
ValueError('Wrong xpath expression:%r' % base_xpath_expression)
raise
ValueError('Wrong xpath expression:%r' % base_xpath_expression)
if base_xpath_expression not in xpath_expression_update_dict:
if base_xpath_expression not in xpath_expression_update_dict:
xpath_expression_update_dict[base_xpath_expression] =
\
xpath_expression_update_dict[base_xpath_expression] =
\
dict(xml=xupdated_node,
dict(xml=xupdated_node,
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLEngineAsynchronous.py
View file @
c551be23
...
@@ -145,7 +145,7 @@ class SyncMLAsynchronousEngine(SyncMLEngineMixin):
...
@@ -145,7 +145,7 @@ class SyncMLAsynchronousEngine(SyncMLEngineMixin):
"""
"""
Process the package 4 of the SyncML DS exchange
Process the package 4 of the SyncML DS exchange
"""
"""
if
False
:
if
False
:
# pylint:disable=using-constant-test
pass
pass
# not subscriber.checkCorrectRemoteMessageId(
# not subscriber.checkCorrectRemoteMessageId(
# syncml_request.header['message_id']):
# syncml_request.header['message_id']):
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLMessage.py
View file @
c551be23
...
@@ -225,41 +225,41 @@ class SyncMLResponse(object):
...
@@ -225,41 +225,41 @@ class SyncMLResponse(object):
receiving a challenge message
receiving a challenge message
"""
"""
raise
NotImplementedError
(
"To review"
)
raise
NotImplementedError
(
"To review"
)
"""
# create element 'SyncML' with a default namespace
#
# create element 'SyncML' with a default namespace
xml = E.SyncML()
#
xml = E.SyncML()
# syncml header
#
# syncml header
xml.append(self.buildHeader(
#
xml.append(self.buildHeader(
session_id=subscription.incrementSessionId(),
#
session_id=subscription.incrementSessionId(),
msg_id=subscription.incrementMessageId(),
#
msg_id=subscription.incrementMessageId(),
target=subscription.getUrlString(),
#
target=subscription.getUrlString(),
source=subscription.getSubscriptionUrlString(),
#
source=subscription.getSubscriptionUrlString(),
user_id=subscription.getUserId(),
#
user_id=subscription.getUserId(),
password=subscription.getPassword(),
#
password=subscription.getPassword(),
authentication_format=subscription.getAuthenticationFormat(),
#
authentication_format=subscription.getAuthenticationFormat(),
authentication_type=subscription.getAuthenticationType()))
#
authentication_type=subscription.getAuthenticationType()))
#
# Build the message body
#
# Build the message body
sync_body = E.SyncBody()
#
sync_body = E.SyncBody()
#
# alert message
#
# alert message
sync_body.append(self.buildAlertMessage(
#
sync_body.append(self.buildAlertMessage(
command_id=self._getNextCommandId(),
#
command_id=self._getNextCommandId(),
alert_code=subscription.getSyncmlAlertCode(),
#
alert_code=subscription.getSyncmlAlertCode(),
target=subscription.getDestinationReference(),
#
target=subscription.getDestinationReference(),
source=subscription.getSourceReference(),
#
source=subscription.getSourceReference(),
last_anchor=subscription.getLastAnchor(),
#
last_anchor=subscription.getLastAnchor(),
next_anchor=subscription.getNextAnchor()))
#
next_anchor=subscription.getNextAnchor()))
syncml_put = self.buildPutMessage(subscription)
#
syncml_put = self.buildPutMessage(subscription)
if syncml_put is not None:
#
if syncml_put is not None:
sync_body.append(syncml_put)
#
sync_body.append(syncml_put)
sync_body.append(E.Final())
#
sync_body.append(E.Final())
#
xml.append(sync_body)
#
xml.append(sync_body)
xml_string = etree.tostring(xml, encoding='utf-8', xml_declaration=True,
#
xml_string = etree.tostring(xml, encoding='utf-8', xml_declaration=True,
pretty_print=True)
#
pretty_print=True)
self.data_append(xml_string)
#
self.data_append(xml_string)
"""
def
addPutMessage
(
self
,
subscription
,
markup
=
'Put'
,
def
addPutMessage
(
self
,
subscription
,
markup
=
'Put'
,
cmd_ref
=
None
,
message_id
=
None
):
cmd_ref
=
None
,
message_id
=
None
):
...
@@ -280,61 +280,59 @@ class SyncMLResponse(object):
...
@@ -280,61 +280,59 @@ class SyncMLResponse(object):
Both must be able to handle and process these informations
Both must be able to handle and process these informations
"""
"""
return
return
"""
# # XXX-Aurel : must be reviewed according to specification
# XXX-Aurel : must be reviewed according to specification
# # This part can be skipped for now
# This part can be skipped for now
# conduit = subscription.getConduit()
conduit = subscription.getConduit()
# xml = None
xml = None
# # The conduit defined what capabilities the service offers
# The conduit defined what capabilities the service offers
# if getattr(conduit, 'getCapabilitiesCTTypeList', None) and \
if getattr(conduit, 'getCapabilitiesCTTypeList', None) and
\
# getattr(conduit, 'getCapabilitiesVerCTList', None) and \
getattr(conduit, 'getCapabilitiesVerCTList', None) and
\
# getattr(conduit, 'getPreferedCapabilitieVerCT', None):
getattr(conduit, 'getPreferedCapabilitieVerCT', None):
# xml = Element('{%s}%s' % (SYNCML_NAMESPACE, markup))
xml = Element('{%s}%s' % (SYNCML_NAMESPACE, markup))
# xml.append(E.CmdID(self._getNextCommandId()))
xml.append(E.CmdID(self._getNextCommandId()))
# if message_id:
if message_id:
# xml.append(E.MsgRef('%s' % message_id))
xml.append(E.MsgRef('%s' % message_id))
# if cmd_ref:
if cmd_ref:
# xml.append(E.CmdRef('%s' % cmd_ref))
xml.append(E.CmdRef('%s' % cmd_ref))
# xml.extend((E.Meta(E.Type('application/vnd.syncml-devinf+xml')),
xml.extend((E.Meta(E.Type('application/vnd.syncml-devinf+xml')),
# E.Item(E.Source(E.LocURI('./devinf12')),
E.Item(E.Source(E.LocURI('./devinf12')),
# E.Data(E.DevInf(E.VerDTD('1.2'),
E.Data(E.DevInf(E.VerDTD('1.2'),
# E.Man('Nexedi'),
E.Man('Nexedi'),
# E.Mod('ERP5SyncML'),
E.Mod('ERP5SyncML'),
# E.OEM('Open Source'),
E.OEM('Open Source'),
# E.SwV('0.1'),
E.SwV('0.1'),
# E.DevID(subscription.getSubscriptionUrlString()),
E.DevID(subscription.getSubscriptionUrlString()),
# E.DevTyp('workstation'),
E.DevTyp('workstation'),
# E.UTC(),
E.UTC(),
# E.DataStore(E.SourceRef(subscription.getSourceReference()))
E.DataStore(E.SourceRef(subscription.getSourceReference()))
# )
)
# )
)
# )))
)))
# data_store = xml.find('{%(ns)s}Item/{%(ns)s}Data/{%(ns)s}DevInf/{%(ns)s}DataStore' % {'ns': SYNCML_NAMESPACE})
data_store = xml.find('{%(ns)s}Item/{%(ns)s}Data/{%(ns)s}DevInf/{%(ns)s}DataStore' % {'ns': SYNCML_NAMESPACE})
# tx_element_list = []
tx_element_list = []
# rx_element_list = []
rx_element_list = []
# for cttype in conduit.getCapabilitiesCTTypeList():
for cttype in conduit.getCapabilitiesCTTypeList():
# if cttype != 'text/xml':
if cttype != 'text/xml':
# for x_version in conduit.getCapabilitiesVerCTList(cttype):
for x_version in conduit.getCapabilitiesVerCTList(cttype):
# rx_element_list.append(E.Rx(E.CTType(cttype), E.VerCT(x_version)))
rx_element_list.append(E.Rx(E.CTType(cttype), E.VerCT(x_version)))
# tx_element_list.append(E.Tx(E.CTType(cttype), E.VerCT(x_version)))
tx_element_list.append(E.Tx(E.CTType(cttype), E.VerCT(x_version)))
# rx_pref = Element('{%s}Rx-Pref' % SYNCML_NAMESPACE)
rx_pref = Element('{%s}Rx-Pref' % SYNCML_NAMESPACE)
# rx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()),
rx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()),
# E.VerCT(conduit.getPreferedCapabilitieVerCT())))
E.VerCT(conduit.getPreferedCapabilitieVerCT())))
# data_store.append(rx_pref)
data_store.append(rx_pref)
# data_store.extend(rx_element_list)
data_store.extend(rx_element_list)
# tx_pref = Element('{%s}Tx-Pref' % SYNCML_NAMESPACE)
tx_pref = Element('{%s}Tx-Pref' % SYNCML_NAMESPACE)
# tx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()),
tx_pref.extend((E.CTType(conduit.getPreferedCapabilitieCTType()),
# E.VerCT(conduit.getPreferedCapabilitieVerCT())))
E.VerCT(conduit.getPreferedCapabilitieVerCT())))
# data_store.append(tx_pref)
data_store.append(tx_pref)
# data_store.extend(tx_element_list)
data_store.extend(tx_element_list)
# data_store.append(E.SyncCap(
data_store.append(E.SyncCap(
# E.SyncType('2'),
E.SyncType('2'),
# E.SyncType('1'),
E.SyncType('1'),
# E.SyncType('4'),
E.SyncType('4'),
# E.SyncType('6')
E.SyncType('6')
# ))
))
# self.data_append(xml)
self.data_append(xml)
"""
def
addSyncCommand
(
self
,
sync_command
,
gid
,
data
,
media_type
,
more_data
):
def
addSyncCommand
(
self
,
sync_command
,
gid
,
data
,
media_type
,
more_data
):
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py
View file @
c551be23
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#
#
##############################################################################
##############################################################################
from
erp5.component.module.SyncMLTransportHTTP
import
ConnectionError
from
erp5.component.module.SyncMLTransportHTTP
import
ConnectionError
as
_ConnectionError
class
FileTransport
:
class
FileTransport
:
...
@@ -35,4 +35,4 @@ class FileTransport:
...
@@ -35,4 +35,4 @@ class FileTransport:
with
open
(
filename
,
'wb'
)
as
stream
:
with
open
(
filename
,
'wb'
)
as
stream
:
stream
.
write
(
data
)
stream
.
write
(
data
)
except
IOError
:
except
IOError
:
raise
ConnectionError
raise
_
ConnectionError
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportHTTP.py
View file @
c551be23
...
@@ -31,7 +31,7 @@ from requests import post
...
@@ -31,7 +31,7 @@ from requests import post
syncml_logger
=
getLogger
(
'ERP5SyncML'
)
syncml_logger
=
getLogger
(
'ERP5SyncML'
)
class
ConnectionError
(
Exception
):
class
ConnectionError
(
Exception
):
# pylint:disable=redefined-builtin
pass
pass
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportMail.py
View file @
c551be23
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#
#
##############################################################################
##############################################################################
from
erp5.component.module.SyncMLTransportHTTP
import
ConnectionError
from
erp5.component.module.SyncMLTransportHTTP
import
ConnectionError
as
_ConnectionError
from
Products.ERP5.ERP5Site
import
getSite
from
Products.ERP5.ERP5Site
import
getSite
class
MailTransport
:
class
MailTransport
:
...
@@ -36,4 +36,4 @@ class MailTransport:
...
@@ -36,4 +36,4 @@ class MailTransport:
try
:
try
:
getSite
().
sendMail
(
from_address
,
to_address
,
sync_id
,
xml
)
getSite
().
sendMail
(
from_address
,
to_address
,
sync_id
,
xml
)
except
:
except
:
raise
ConnectionError
raise
_
ConnectionError
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.VCardConduit.py
View file @
c551be23
...
@@ -141,7 +141,7 @@ class VCardConduit(ERP5Conduit):
...
@@ -141,7 +141,7 @@ class VCardConduit(ERP5Conduit):
property_value_list_well_incoded
=
[]
property_value_list_well_incoded
=
[]
if
encoding
==
'QUOTED-PRINTABLE'
:
if
encoding
==
'QUOTED-PRINTABLE'
:
import
mimify
import
mimify
# pylint:disable=import-error
for
property_value
in
property_value_list
:
for
property_value
in
property_value_list
:
property_value
=
mimify
.
mime_decode
(
property_value
)
property_value
=
mimify
.
mime_decode
(
property_value
)
property_value_list_well_incoded
.
append
(
property_value
)
property_value_list_well_incoded
.
append
(
property_value
)
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XupdateUtils.py
View file @
c551be23
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#
#
##############################################################################
##############################################################################
import
six
from
erp5.component.module.XMLSyncUtils
import
XMLSyncUtilsMixin
from
erp5.component.module.XMLSyncUtils
import
XMLSyncUtilsMixin
from
xml.dom.ext.reader.Sax2
import
FromXml
# pylint:disable=no-name-in-module,import-error
from
xml.dom.ext.reader.Sax2
import
FromXml
# pylint:disable=no-name-in-module,import-error
...
@@ -40,7 +41,7 @@ class XupdateUtils(XMLSyncUtilsMixin):
...
@@ -40,7 +41,7 @@ class XupdateUtils(XMLSyncUtilsMixin):
Parse the xupdate and then it will call the conduit
Parse the xupdate and then it will call the conduit
"""
"""
conflict_list
=
[]
conflict_list
=
[]
if
isinstance
(
xupdate
,
(
str
,
unicode
)
):
if
isinstance
(
xupdate
,
six
.
string_types
):
xupdate
=
FromXml
(
xupdate
)
xupdate
=
FromXml
(
xupdate
)
for
subnode
in
xupdate
:
for
subnode
in
xupdate
:
...
...
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