From 6f205ca138a9d61c7f58fb438718f8f1e1b6cc34 Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Tue, 14 Aug 2007 14:02:36 +0000 Subject: [PATCH] - remove som unused import - use IConduit Interface git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15671 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5SyncML/Conduit/ERP5Conduit.py | 23 ++++++++++------------ product/ERP5SyncML/Conduit/VCardConduit.py | 7 ++++--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/product/ERP5SyncML/Conduit/ERP5Conduit.py b/product/ERP5SyncML/Conduit/ERP5Conduit.py index 922b85ded5..92c1e594e3 100644 --- a/product/ERP5SyncML/Conduit/ERP5Conduit.py +++ b/product/ERP5SyncML/Conduit/ERP5Conduit.py @@ -26,28 +26,21 @@ # ############################################################################## -from Products.ERP5SyncML.SyncCode import SyncCode from Products.ERP5SyncML.XMLSyncUtils import XMLSyncUtilsMixin from Products.ERP5SyncML.Subscription import Conflict 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 DateTime.DateTime import DateTime from email.MIMEBase import MIMEBase from email import Encoders from AccessControl import ClassSecurityInfo -from AccessControl.PermissionMapping import setPermissionMapping -from Products.ERP5Type import Permissions +from Products.ERP5Type import Permissions, Interface from Globals import PersistentMapping import pickle -import string from cStringIO import StringIO from xml.sax.saxutils import escape, unescape -import re, copy +import re import cStringIO - from zLOG import LOG, INFO, DEBUG try: from Ft.Xml.Domlette import Print, PrettyPrint @@ -61,6 +54,7 @@ except ImportError: def __init__(self, *args, **kw): raise ImportError, "Sorry, it was not possible to import Ft library" + class ERP5Conduit(XMLSyncUtilsMixin): """ A conduit is a piece of code in charge of @@ -96,10 +90,11 @@ class ERP5Conduit(XMLSyncUtilsMixin): 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 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - - """ + # Declarative interfaces + __implements__ = ( Interface.IConduit, ) + # Declarative security security = ClassSecurityInfo() @@ -344,10 +339,12 @@ class ERP5Conduit(XMLSyncUtilsMixin): # This is the place where we should look for conflicts # For that we need : # - 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 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, data_type=data_type) #current_data = object.getProperty(keyword) diff --git a/product/ERP5SyncML/Conduit/VCardConduit.py b/product/ERP5SyncML/Conduit/VCardConduit.py index 913a145e22..40d42e83a5 100755 --- a/product/ERP5SyncML/Conduit/VCardConduit.py +++ b/product/ERP5SyncML/Conduit/VCardConduit.py @@ -1,6 +1,6 @@ ############################################################################## # -# 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> # # WARNING: This program as such is intended to be used by professional @@ -55,7 +55,7 @@ class VCardConduit(ERP5Conduit, SyncCode): self.args = {} - security.declareProtected(Permissions.ModifyPortalContent, 'addVCard') + security.declareProtected(Permissions.ModifyPortalContent, 'addNode') def addNode(self, xml=None, object=None, previous_xml=None, object_id=None, sub_object=None, force=0, simulate=0, **kw): """ @@ -80,6 +80,7 @@ class VCardConduit(ERP5Conduit, SyncCode): #in a first time, conflict are not used return {'conflict_list':None, 'object': new_object} + security.declareProtected(Permissions.ModifyPortalContent, 'deleteNode') def deleteNode(self, xml=None, object=None, object_id=None, force=None, simulate=0, **kw): """ @@ -93,6 +94,7 @@ class VCardConduit(ERP5Conduit, SyncCode): LOG('VCardConduit',0,'deleteNode, Unable to delete: %s' % str(object_id)) return conflict_list + security.declareProtected(Permissions.ModifyPortalContent, 'updateNode') def updateNode(self, xml=None, object=None, previous_xml=None, force=0, simulate=0, **kw): """ @@ -119,7 +121,6 @@ class VCardConduit(ERP5Conduit, SyncCode): verCTTypeList[self.MEDIA_TYPE['TEXT_XVCARD']]=('2.1',) return verCTTypeList[capabilities_ct_type] - def getPreferedCapabilitieVerCT(self): """ return the prefered capabilitie VerCT -- 2.30.9