Commit 6f205ca1 authored by Fabien Morin's avatar Fabien Morin

- remove som unused import

- use IConduit Interface


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15671 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6850e7e2
...@@ -26,28 +26,21 @@ ...@@ -26,28 +26,21 @@
# #
############################################################################## ##############################################################################
from Products.ERP5SyncML.SyncCode import SyncCode
from Products.ERP5SyncML.XMLSyncUtils import XMLSyncUtilsMixin from Products.ERP5SyncML.XMLSyncUtils import XMLSyncUtilsMixin
from Products.ERP5SyncML.Subscription import Conflict from Products.ERP5SyncML.Subscription import Conflict
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5SyncML.XupdateUtils import XupdateUtils
from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5Type.Accessor.TypeDefinition import list_types
from Products.ERP5SyncML.XMLSyncUtils import Parse from Products.ERP5SyncML.XMLSyncUtils import Parse
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
from email.MIMEBase import MIMEBase from email.MIMEBase import MIMEBase
from email import Encoders from email import Encoders
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.PermissionMapping import setPermissionMapping from Products.ERP5Type import Permissions, Interface
from Products.ERP5Type import Permissions
from Globals import PersistentMapping from Globals import PersistentMapping
import pickle import pickle
import string
from cStringIO import StringIO from cStringIO import StringIO
from xml.sax.saxutils import escape, unescape from xml.sax.saxutils import escape, unescape
import re, copy import re
import cStringIO import cStringIO
from zLOG import LOG, INFO, DEBUG from zLOG import LOG, INFO, DEBUG
try: try:
from Ft.Xml.Domlette import Print, PrettyPrint from Ft.Xml.Domlette import Print, PrettyPrint
...@@ -61,6 +54,7 @@ except ImportError: ...@@ -61,6 +54,7 @@ except ImportError:
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
raise ImportError, "Sorry, it was not possible to import Ft library" raise ImportError, "Sorry, it was not possible to import Ft library"
class ERP5Conduit(XMLSyncUtilsMixin): class ERP5Conduit(XMLSyncUtilsMixin):
""" """
A conduit is a piece of code in charge of A conduit is a piece of code in charge of
...@@ -96,10 +90,11 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -96,10 +90,11 @@ class ERP5Conduit(XMLSyncUtilsMixin):
the response of the client, so that we are not sure if it take into account, the response of the client, so that we are not sure if it take into account,
we may have CONFLICT_NOT_SYNCHRONIZED AND CONFLICT_SYNCHRONIZED we may have CONFLICT_NOT_SYNCHRONIZED AND CONFLICT_SYNCHRONIZED
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
""" """
# Declarative interfaces
__implements__ = ( Interface.IConduit, )
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
...@@ -344,10 +339,12 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -344,10 +339,12 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# This is the place where we should look for conflicts # This is the place where we should look for conflicts
# For that we need : # For that we need :
# - data : the data from the remote box # - data : the data from the remote box
# - old_data : the data from this box but at the time of the last synchronization # - old_data : the data from this box but at the time of the i
#last synchronization
# - current_data : the data actually on this box # - current_data : the data actually on this box
isConflict = 0 isConflict = 0
if (previous_xml is not None) and (not force): # if no previous_xml, no conflict if (previous_xml is not None) and (not force):
# if no previous_xml, no conflict
old_data = self.getObjectProperty(keyword, previous_xml, old_data = self.getObjectProperty(keyword, previous_xml,
data_type=data_type) data_type=data_type)
#current_data = object.getProperty(keyword) #current_data = object.getProperty(keyword)
......
############################################################################## ##############################################################################
# #
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
# Fabien Morin <fabien.morin@gmail.com> # Fabien Morin <fabien.morin@gmail.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
...@@ -55,7 +55,7 @@ class VCardConduit(ERP5Conduit, SyncCode): ...@@ -55,7 +55,7 @@ class VCardConduit(ERP5Conduit, SyncCode):
self.args = {} self.args = {}
security.declareProtected(Permissions.ModifyPortalContent, 'addVCard') security.declareProtected(Permissions.ModifyPortalContent, 'addNode')
def addNode(self, xml=None, object=None, previous_xml=None, def addNode(self, xml=None, object=None, previous_xml=None,
object_id=None, sub_object=None, force=0, simulate=0, **kw): object_id=None, sub_object=None, force=0, simulate=0, **kw):
""" """
...@@ -80,6 +80,7 @@ class VCardConduit(ERP5Conduit, SyncCode): ...@@ -80,6 +80,7 @@ class VCardConduit(ERP5Conduit, SyncCode):
#in a first time, conflict are not used #in a first time, conflict are not used
return {'conflict_list':None, 'object': new_object} return {'conflict_list':None, 'object': new_object}
security.declareProtected(Permissions.ModifyPortalContent, 'deleteNode')
def deleteNode(self, xml=None, object=None, object_id=None, force=None, def deleteNode(self, xml=None, object=None, object_id=None, force=None,
simulate=0, **kw): simulate=0, **kw):
""" """
...@@ -93,6 +94,7 @@ class VCardConduit(ERP5Conduit, SyncCode): ...@@ -93,6 +94,7 @@ class VCardConduit(ERP5Conduit, SyncCode):
LOG('VCardConduit',0,'deleteNode, Unable to delete: %s' % str(object_id)) LOG('VCardConduit',0,'deleteNode, Unable to delete: %s' % str(object_id))
return conflict_list return conflict_list
security.declareProtected(Permissions.ModifyPortalContent, 'updateNode')
def updateNode(self, xml=None, object=None, previous_xml=None, force=0, def updateNode(self, xml=None, object=None, previous_xml=None, force=0,
simulate=0, **kw): simulate=0, **kw):
""" """
...@@ -119,7 +121,6 @@ class VCardConduit(ERP5Conduit, SyncCode): ...@@ -119,7 +121,6 @@ class VCardConduit(ERP5Conduit, SyncCode):
verCTTypeList[self.MEDIA_TYPE['TEXT_XVCARD']]=('2.1',) verCTTypeList[self.MEDIA_TYPE['TEXT_XVCARD']]=('2.1',)
return verCTTypeList[capabilities_ct_type] return verCTTypeList[capabilities_ct_type]
def getPreferedCapabilitieVerCT(self): def getPreferedCapabilitieVerCT(self):
""" """
return the prefered capabilitie VerCT return the prefered capabilitie VerCT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment