Commit a2b4c035 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_interfaces: Migrate SOAPBinding and InterfaceTool from filesystem.

parent 4c8bc987
...@@ -30,7 +30,6 @@ from AccessControl import ClassSecurityInfo ...@@ -30,7 +30,6 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
from Products.ERP5Type.Permissions import AccessContentsInformation from Products.ERP5Type.Permissions import AccessContentsInformation
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5Type.Cache import transactional_cached
try: try:
from spyne import MethodContext from spyne import MethodContext
except ImportError: except ImportError:
...@@ -60,13 +59,13 @@ class SOAPBinding(Base): ...@@ -60,13 +59,13 @@ class SOAPBinding(Base):
security.declarePrivate('registerServiceClass') security.declarePrivate('registerServiceClass')
@classmethod @classmethod
def registerServiceClass(cls, service_class): def registerServiceClass(cls, service_class):
path = '%s.%s' % (service_class.__module__, service_class.__name__) path = '%s.%s' % (service_class.__module__, service_class.__name__)
cls._service_class_dict[path] = service_class cls._service_class_dict[path] = service_class
@classmethod @classmethod
def getRegisteredServiceClassItemList(cls): def getRegisteredServiceClassItemList(cls):
return sorted(('%s (%s)' % (v.__name__, v.__module__), k) return sorted(('%s (%s)' % (v.__name__, v.__module__), k)
for k, v in cls._service_class_dict.iteritems()) for k, v in cls._service_class_dict.iteritems())
security.declarePrivate('getListItemUrl') security.declarePrivate('getListItemUrl')
def getListItemUrl(self, *args): def getListItemUrl(self, *args):
...@@ -74,7 +73,7 @@ class SOAPBinding(Base): ...@@ -74,7 +73,7 @@ class SOAPBinding(Base):
def _getServer(self): def _getServer(self):
try: try:
serial, server = self._v_server serial, server = self._v_server # pylint: disable=access-member-before-definition
if serial == self._p_serial: if serial == self._p_serial:
return server return server
except AttributeError: except AttributeError:
...@@ -86,7 +85,7 @@ class SOAPBinding(Base): ...@@ -86,7 +85,7 @@ class SOAPBinding(Base):
self._v_server = self._p_serial, server self._v_server = self._p_serial, server
return server return server
def __call__(self, REQUEST): def __call__(self, REQUEST): # pylint: disable=arguments-differ
server = self._getServer() server = self._getServer()
if REQUEST.method == 'GET': if REQUEST.method == 'GET':
wsdl = Wsdl11(server.app.interface) wsdl = Wsdl11(server.app.interface)
...@@ -96,7 +95,7 @@ class SOAPBinding(Base): ...@@ -96,7 +95,7 @@ class SOAPBinding(Base):
if hasattr(MethodContext, 'SERVER'): if hasattr(MethodContext, 'SERVER'):
ctx = MethodContext(server, MethodContext.SERVER) ctx = MethodContext(server, MethodContext.SERVER)
else: # BBB spyne < 2.12 else: # BBB spyne < 2.12
ctx = MethodContext(server) ctx = MethodContext(server) # pylint: disable=no-value-for-parameter
ctx.in_string = REQUEST.stdin ctx.in_string = REQUEST.stdin
ctx, = server.generate_contexts(ctx) ctx, = server.generate_contexts(ctx)
ctx.udc = self ctx.udc = self
...@@ -116,7 +115,7 @@ except ImportError: ...@@ -116,7 +115,7 @@ except ImportError:
else: else:
class HelloWorldService(ServiceBase): class HelloWorldService(ServiceBase):
@rpc(Unicode, Integer, _returns=Iterable(Unicode)) @rpc(Unicode, Integer, _returns=Iterable(Unicode))
def say_hello(ctx, name, times): def say_hello(ctx, name, times): # pylint: disable=no-self-argument
''' '''
Docstrings for service methods appear as documentation in the wsdl Docstrings for service methods appear as documentation in the wsdl
<b>what fun</b> <b>what fun</b>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SOAPBinding</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.SOAPBinding</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.SOAPBinding</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
import unittest import unittest
import SOAPpy import SOAPpy
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5.Document.SOAPBinding import SOAPBinding from erp5.component.document.SOAPBinding import SOAPBinding
from spyne.service import ServiceBase from spyne.service import ServiceBase
from spyne.decorator import srpc from spyne.decorator import srpc
from spyne.model.complex import Iterable from spyne.model.complex import Iterable
......
...@@ -30,12 +30,11 @@ from Products.ERP5Type.Globals import InitializeClass ...@@ -30,12 +30,11 @@ from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
class InterfaceTool(BaseTool): class InterfaceTool(BaseTool):
""" """
Placeholder for SOAP Interfaces Placeholder for SOAP Interfaces
""" """
id = 'portal_interfaces'
meta_type = 'ERP5 Interface Tool'
portal_type = 'Interface Tool'
id = 'portal_interfaces' InitializeClass(InterfaceTool)
meta_type = 'ERP5 Interface Tool' \ No newline at end of file
portal_type = 'Interface Tool'
InitializeClass(InterfaceTool)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Tool Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>InterfaceTool</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Tool.InterfaceTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>tool.erp5.InterfaceTool</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Tool Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
document.erp5.SOAPBinding
\ No newline at end of file
tool.erp5.InterfaceTool
\ No newline at end of file
...@@ -46,7 +46,7 @@ from Tool import CategoryTool, IdTool, TemplateTool,\ ...@@ -46,7 +46,7 @@ from Tool import CategoryTool, IdTool, TemplateTool,\
TrashTool, ContributionTool, NotificationTool, PasswordTool,\ TrashTool, ContributionTool, NotificationTool, PasswordTool,\
GadgetTool, ContributionRegistryTool, IntrospectionTool,\ GadgetTool, ContributionRegistryTool, IntrospectionTool,\
AcknowledgementTool, SolverTool,\ AcknowledgementTool, SolverTool,\
UrlRegistryTool, InterfaceTool,\ UrlRegistryTool,\
CertificateAuthorityTool, InotifyTool CertificateAuthorityTool, InotifyTool
import ERP5Site import ERP5Site
from Document import PythonScript, SQLMethod from Document import PythonScript, SQLMethod
...@@ -72,7 +72,6 @@ portal_tools = ( CategoryTool.CategoryTool, ...@@ -72,7 +72,6 @@ portal_tools = ( CategoryTool.CategoryTool,
UrlRegistryTool.UrlRegistryTool, UrlRegistryTool.UrlRegistryTool,
CertificateAuthorityTool.CertificateAuthorityTool, CertificateAuthorityTool.CertificateAuthorityTool,
InotifyTool.InotifyTool, InotifyTool.InotifyTool,
InterfaceTool.InterfaceTool,
) )
content_classes = () content_classes = ()
content_constructors = () content_constructors = ()
......
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