Commit 4bca2e87 authored by Ivan Tyagov's avatar Ivan Tyagov

Implement generic mix in WebService class.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25670 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83f61201
No related merge requests found
...@@ -39,9 +39,9 @@ from Products.ERP5Type.Cache import CachingMethod ...@@ -39,9 +39,9 @@ from Products.ERP5Type.Cache import CachingMethod
class IntrospectionTool(BaseTool, LogMixIn): class IntrospectionTool(BaseTool, LogMixIn):
""" """
This tool provides both local and remote introspection. This tool provides both local and remote introspection.
""" """
id = 'portal_introspections' id = 'portal_introspections'
title = 'Introspection Tool' title = 'Introspection Tool'
meta_type = 'ERP5 Introspection Tool' meta_type = 'ERP5 Introspection Tool'
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Wizard.transport.XMLRPCConnection import XMLRPCConnection
from Products.ERP5Wizard.transport.SOAPConnection import SOAPConnection
class WebServiceMixIn: class WebServiceMixIn:
""" """
...@@ -38,10 +39,18 @@ class WebServiceMixIn: ...@@ -38,10 +39,18 @@ class WebServiceMixIn:
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareProtected('connect', Permissions.ManagePortal) 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 Connect to remote instances
of any kind of web service (not only ERP5) with many of any kind of web service (not only ERP5) with many
different kinds of authentication. different kinds of authentication.
authentication_method: 'xml-rpc' or 'soap'
""" """
pass # XXX: implement connection caching per zope thread
\ No newline at end of file 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
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