[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Merge from 3.3 branch:
Philipp von Weitershausen
philikon at philikon.de
Fri Jul 7 12:19:51 EDT 2006
Log message for revision 69031:
Merge from 3.3 branch:
Log message for revision 69027:
Make this test a normal test (as opposed to an ftest)
Log message for revision 69028:
Move some configuration items from zope.app.publisher to zope.publisher
now that zope.publisher has its own configure.zcml. Especially the apidoc
directive is important since it will now work when zope.publisher and zope.app
aren't installed in the same package tree.
Changed:
U Zope3/trunk/src/zope/app/publisher/browser/configure.zcml
U Zope3/trunk/src/zope/app/publisher/configure.zcml
U Zope3/trunk/src/zope/publisher/configure.zcml
U Zope3/trunk/src/zope/publisher/tests/test_xmlrpc.py
U Zope3/trunk/src/zope/publisher/xmlrpc.py
-=-
Modified: Zope3/trunk/src/zope/app/publisher/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/configure.zcml 2006-07-07 16:14:38 UTC (rev 69030)
+++ Zope3/trunk/src/zope/app/publisher/browser/configure.zcml 2006-07-07 16:19:46 UTC (rev 69031)
@@ -5,9 +5,6 @@
<interface
interface="zope.app.publisher.interfaces.browser.IMenuItemType" />
-<interface
- interface="zope.publisher.interfaces.browser.IBrowserSkinType" />
-
<utility
name="Browser Skins"
component=".vocabulary.BrowserSkinsVocabulary"
Modified: Zope3/trunk/src/zope/app/publisher/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publisher/configure.zcml 2006-07-07 16:14:38 UTC (rev 69030)
+++ Zope3/trunk/src/zope/app/publisher/configure.zcml 2006-07-07 16:19:46 UTC (rev 69031)
@@ -7,21 +7,6 @@
<include package=".xmlrpc" />
<include file="http.zcml" />
- <interface interface="zope.publisher.interfaces.xmlrpc.IXMLRPCRequest" />
- <configure
- xmlns:zcml="http://namespaces.zope.org/zcml"
- zcml:condition="have apidoc"
- xmlns="http://namespaces.zope.org/apidoc"
- >
-
- <bookchapter
- id="zopepublisherhttpresults.txt"
- title="Creating HTTP Results"
- doc_path="../../publisher/httpresults.txt"
- />
-
- </configure>
-
</configure>
Modified: Zope3/trunk/src/zope/publisher/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/publisher/configure.zcml 2006-07-07 16:14:38 UTC (rev 69030)
+++ Zope3/trunk/src/zope/publisher/configure.zcml 2006-07-07 16:19:46 UTC (rev 69031)
@@ -1,33 +1,24 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:apidoc="http://namespaces.zope.org/apidoc"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ >
- <adapter
- for="list"
- factory=".xmlrpc.ListPreMarshaller"
- />
+ <interface interface="zope.publisher.interfaces.browser.IBrowserSkinType" />
+ <interface interface="zope.publisher.interfaces.xmlrpc.IXMLRPCRequest" />
- <adapter
- for="tuple"
- factory=".xmlrpc.ListPreMarshaller"
- />
+ <adapter factory=".xmlrpc.ListPreMarshaller" />
+ <adapter factory=".xmlrpc.TuplePreMarshaller" />
+ <adapter factory=".xmlrpc.FaultPreMarshaller" />
+ <adapter factory=".xmlrpc.DateTimePreMarshaller" />
+ <adapter factory=".xmlrpc.PythonDateTimePreMarshaller" />
+ <adapter factory=".xmlrpc.DictPreMarshaller" />
- <adapter
- factory=".xmlrpc.FaultPreMarshaller"
- for="xmlrpclib.Fault"
+ <apidoc:bookchapter
+ zcml:condition="have apidoc"
+ id="zopepublisherhttpresults.txt"
+ title="Creating HTTP Results"
+ doc_path="publisher/httpresults.txt"
/>
- <adapter
- factory=".xmlrpc.DateTimePreMarshaller"
- for="xmlrpclib.DateTime"
- />
-
- <adapter
- factory=".xmlrpc.PythonDateTimePreMarshaller"
- for="datetime.datetime"
- />
-
- <adapter
- factory=".xmlrpc.DictPreMarshaller"
- for="dict"
- />
-
</configure>
Modified: Zope3/trunk/src/zope/publisher/tests/test_xmlrpc.py
===================================================================
--- Zope3/trunk/src/zope/publisher/tests/test_xmlrpc.py 2006-07-07 16:14:38 UTC (rev 69030)
+++ Zope3/trunk/src/zope/publisher/tests/test_xmlrpc.py 2006-07-07 16:19:46 UTC (rev 69031)
@@ -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/trunk/src/zope/publisher/xmlrpc.py
===================================================================
--- Zope3/trunk/src/zope/publisher/xmlrpc.py 2006-07-07 16:14:38 UTC (rev 69030)
+++ Zope3/trunk/src/zope/publisher/xmlrpc.py 2006-07-07 16:19:46 UTC (rev 69031)
@@ -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