From 4bca2e870623b139e853a84dbca8f76dbc839239 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Mon, 23 Feb 2009 15:44:58 +0000 Subject: [PATCH] Implement generic mix in WebService class. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25670 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Wizard/Tool/IntrospectionTool.py | 4 ++-- product/ERP5Wizard/WebServiceMixIn.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/product/ERP5Wizard/Tool/IntrospectionTool.py b/product/ERP5Wizard/Tool/IntrospectionTool.py index 4c92354960..6d6220d666 100644 --- a/product/ERP5Wizard/Tool/IntrospectionTool.py +++ b/product/ERP5Wizard/Tool/IntrospectionTool.py @@ -39,9 +39,9 @@ from Products.ERP5Type.Cache import CachingMethod class IntrospectionTool(BaseTool, LogMixIn): """ - This tool provides both local and remote introspection. + This tool provides both local and remote introspection. """ - + id = 'portal_introspections' title = 'Introspection Tool' meta_type = 'ERP5 Introspection Tool' diff --git a/product/ERP5Wizard/WebServiceMixIn.py b/product/ERP5Wizard/WebServiceMixIn.py index 374ebd7607..b885a5de04 100644 --- a/product/ERP5Wizard/WebServiceMixIn.py +++ b/product/ERP5Wizard/WebServiceMixIn.py @@ -28,7 +28,8 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions - +from Products.ERP5Wizard.transport.XMLRPCConnection import XMLRPCConnection +from Products.ERP5Wizard.transport.SOAPConnection import SOAPConnection class WebServiceMixIn: """ @@ -38,10 +39,18 @@ class WebServiceMixIn: security = ClassSecurityInfo() security.declareProtected('connect', Permissions.ManagePortal) - def connect(self, url, user=None, password=None, authentication_method=None): + def connect(self, url, user_name=None, password=None, authentication_method=None): """ Connect to remote instances of any kind of web service (not only ERP5) with many different kinds of authentication. + authentication_method: 'xml-rpc' or 'soap' """ - pass \ No newline at end of file + # XXX: implement connection caching per zope thread + if authentication_method == 'xml-rpc': + connection_handler = XMLRPCConnection(url, user_name, password) + elif authentication_method == 'soap': + connection_handler = SOAPConnection(url, user_name, password) + + connection_handler = connection_handler.connect() + return connection_handler \ No newline at end of file -- 2.30.9