Commit 12f5f171 authored by Sebastien Robin's avatar Sebastien Robin

edit object in a separate method


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@523 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 51300f7e
......@@ -390,7 +390,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# We will now apply the argument with the method edit
if args != {} and (isConflict==0 or force) and (not simulate):
LOG('updateNode',0,'object._edit, args: %s' % str(args))
object._edit(**args)
#object._edit(**args)
self.editDocument(object=object,**args)
# It is sometimes required to do something after an edit
if hasattr(object,'manage_afterEdit'):
object.manage_afterEdit()
......@@ -759,7 +760,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
LOG('newObject',0,"args: %s" % str(args))
# edit the object with a dictionnary of arguments,
# like {"telephone_number":"02-5648"}
object._edit(**args)
#object._edit(**args)
self.editDocument(object=object,**args)
if hasattr(object,'manage_afterEdit'):
object.manage_afterEdit()
......@@ -967,6 +969,14 @@ class ERP5Conduit(XMLSyncUtilsMixin):
break
return addable
def editDocument(self, object=None, **kw):
"""
This is the default editDocument method. This method
can easily be overwritten.
"""
object._edit(**kw)
# This doesn't works fine because all workflows variables
# are not set the same way
# if status.has_key('action'):
......
......@@ -44,6 +44,7 @@ from PublicationSynchronization import PublicationSynchronization
from SubscriptionSynchronization import SubscriptionSynchronization
#import sys
#import StringIO
import urllib
import string
from zLOG import *
......@@ -517,5 +518,22 @@ class SynchronizationTool( UniqueObject, SimpleItem,
else:
return context.getPhysicalPath()
def sendResponse(self,url=None, xml=None):
"""
We will look at the url and we will see if we need to send mail, http
response, or just copy to a file.
"""
if type(url) is type('a'):
if url.find('http://')==0:
# we will send an http response
to_encode = (('file',xml))
encoded = urrlib.urlencode(to_encode)
urrlib.open(url, encoded).read()
elif url.find('file://')==0:
# we have to use local files (unit testing for example
pass
elif url.find('mailto:')==0:
# we will send an email
pass
InitializeClass( SynchronizationTool )
......@@ -933,6 +933,10 @@ class TestERP5SyncML(ERP5TypeTestCase):
self.assertEqual(role_1_s,role_1_c)
self.assertEqual(role_2_s,role_2_c)
# We may add a test in order to check if the slow_sync mode works fine, ie
# if we do have both object on the client and server side, we must make sure
# that the server first sends is own data
if __name__ == '__main__':
framework()
else:
......
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