[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/publisher/ Make
this test a normal test (as opposed to an ftest)
Philipp von Weitershausen
philikon at philikon.de
Fri Jul 7 10:39:18 EDT 2006
Log message for revision 69027:
Make this test a normal test (as opposed to an ftest)
Changed:
U Zope3/branches/3.3/src/zope/publisher/configure.zcml
U Zope3/branches/3.3/src/zope/publisher/tests/test_xmlrpc.py
U Zope3/branches/3.3/src/zope/publisher/xmlrpc.py
-=-
Modified: Zope3/branches/3.3/src/zope/publisher/configure.zcml
===================================================================
--- Zope3/branches/3.3/src/zope/publisher/configure.zcml 2006-07-07 13:48:23 UTC (rev 69026)
+++ Zope3/branches/3.3/src/zope/publisher/configure.zcml 2006-07-07 14:39:18 UTC (rev 69027)
@@ -1,33 +1,8 @@
<configure xmlns="http://namespaces.zope.org/zope">
-
- <adapter
- for="list"
- factory=".xmlrpc.ListPreMarshaller"
- />
-
- <adapter
- for="tuple"
- factory=".xmlrpc.ListPreMarshaller"
- />
-
- <adapter
- factory=".xmlrpc.FaultPreMarshaller"
- for="xmlrpclib.Fault"
- />
-
- <adapter
- factory=".xmlrpc.DateTimePreMarshaller"
- for="xmlrpclib.DateTime"
- />
-
- <adapter
- factory=".xmlrpc.PythonDateTimePreMarshaller"
- for="datetime.datetime"
- />
-
- <adapter
- factory=".xmlrpc.DictPreMarshaller"
- for="dict"
- />
-
+ <adapter factory=".xmlrpc.ListPreMarshaller" />
+ <adapter factory=".xmlrpc.TuplePreMarshaller" />
+ <adapter factory=".xmlrpc.FaultPreMarshaller" />
+ <adapter factory=".xmlrpc.DateTimePreMarshaller" />
+ <adapter factory=".xmlrpc.PythonDateTimePreMarshaller" />
+ <adapter factory=".xmlrpc.DictPreMarshaller" />
</configure>
Modified: Zope3/branches/3.3/src/zope/publisher/tests/test_xmlrpc.py
===================================================================
--- Zope3/branches/3.3/src/zope/publisher/tests/test_xmlrpc.py 2006-07-07 13:48:23 UTC (rev 69026)
+++ Zope3/branches/3.3/src/zope/publisher/tests/test_xmlrpc.py 2006-07-07 14:39:18 UTC (rev 69027)
@@ -15,16 +15,30 @@
$Id$
"""
+import xmlrpclib
+import zope.component.testing
+from zope.testing import doctest
+from zope.publisher import xmlrpc
+from zope.security.checker import defineChecker, Checker, CheckerPublic
-import zope.app.testing.functional
+def setUp(test):
+ zope.component.testing.setUp(test)
+ zope.component.provideAdapter(xmlrpc.ListPreMarshaller)
+ zope.component.provideAdapter(xmlrpc.TuplePreMarshaller)
+ zope.component.provideAdapter(xmlrpc.FaultPreMarshaller)
+ zope.component.provideAdapter(xmlrpc.DateTimePreMarshaller)
+ zope.component.provideAdapter(xmlrpc.PythonDateTimePreMarshaller)
+ zope.component.provideAdapter(xmlrpc.DictPreMarshaller)
-from zope.testing import doctest
+ defineChecker(xmlrpclib.Fault,
+ Checker({'faultCode':CheckerPublic,
+ 'faultString': CheckerPublic}, {}))
+ defineChecker(xmlrpclib.DateTime,
+ Checker({'value':CheckerPublic}, {}))
-
def test_suite():
- suite = doctest.DocFileSuite(
- "xmlrpc.txt",
- module_relative=True, package="zope.publisher",
- optionflags=doctest.ELLIPSIS)
- suite.layer = zope.app.testing.functional.Functional
- return suite
+ return doctest.DocFileSuite(
+ "xmlrpc.txt", package="zope.publisher",
+ setUp=setUp, tearDown=zope.component.testing.tearDown,
+ optionflags=doctest.ELLIPSIS
+ )
Modified: Zope3/branches/3.3/src/zope/publisher/xmlrpc.py
===================================================================
--- Zope3/branches/3.3/src/zope/publisher/xmlrpc.py 2006-07-07 13:48:23 UTC (rev 69026)
+++ Zope3/branches/3.3/src/zope/publisher/xmlrpc.py 2006-07-07 14:39:18 UTC (rev 69027)
@@ -19,6 +19,7 @@
"""
import sys
import xmlrpclib
+import datetime
from StringIO import StringIO
import zope.component
@@ -28,7 +29,6 @@
IXMLRPCPublisher, IXMLRPCRequest, IXMLRPCPremarshaller
from zope.publisher.http import HTTPRequest, HTTPResponse, DirectResult
-
from zope.security.proxy import isinstance
class XMLRPCRequest(HTTPRequest):
@@ -173,6 +173,7 @@
class DictPreMarshaller(PreMarshallerBase):
"""Pre-marshaller for dicts"""
+ zope.component.adapts(dict)
def __call__(self):
return dict([(premarshal(k), premarshal(v))
@@ -180,12 +181,17 @@
class ListPreMarshaller(PreMarshallerBase):
"""Pre-marshaller for list"""
+ zope.component.adapts(list)
def __call__(self):
return map(premarshal, self.data)
+class TuplePreMarshaller(ListPreMarshaller):
+ zope.component.adapts(tuple)
+
class FaultPreMarshaller(PreMarshallerBase):
"""Pre-marshaller for xmlrpc.Fault"""
+ zope.component.adapts(xmlrpclib.Fault)
def __call__(self):
return xmlrpclib.Fault(
@@ -195,12 +201,14 @@
class DateTimePreMarshaller(PreMarshallerBase):
"""Pre-marshaller for xmlrpc.DateTime"""
+ zope.component.adapts(xmlrpclib.DateTime)
def __call__(self):
return xmlrpclib.DateTime(self.data.value)
class PythonDateTimePreMarshaller(PreMarshallerBase):
"""Pre-marshaller for datetime.datetime"""
+ zope.component.adapts(datetime.datetime)
def __call__(self):
return xmlrpclib.DateTime(self.data.isoformat())
More information about the Zope3-Checkins
mailing list