[Checkins] SVN: grokcore.rest/trunk/ temporary fixes to get rid of the zope.app.http and zope.app.exception dependencies
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Tue Jan 18 08:06:33 EST 2011
Log message for revision 119641:
temporary fixes to get rid of the zope.app.http and zope.app.exception dependencies
Changed:
U grokcore.rest/trunk/buildout.cfg
U grokcore.rest/trunk/setup.py
U grokcore.rest/trunk/src/grokcore/rest/configure.zcml
U grokcore.rest/trunk/src/grokcore/rest/ftesting.zcml
U grokcore.rest/trunk/src/grokcore/rest/ftests/rest/rest.py
U grokcore.rest/trunk/src/grokcore/rest/rest.py
-=-
Modified: grokcore.rest/trunk/buildout.cfg
===================================================================
--- grokcore.rest/trunk/buildout.cfg 2011-01-18 11:13:48 UTC (rev 119640)
+++ grokcore.rest/trunk/buildout.cfg 2011-01-18 13:06:32 UTC (rev 119641)
@@ -1,33 +1,23 @@
[buildout]
extends = http://svn.zope.org/repos/main/groktoolkit/trunk/grok.cfg
+develop = .
parts =
- test
- omelette
-develop =
- .
-versions = versions
-extensions =
- buildout.dumppickedversions
- mr.developer
+ test
+ omelette
+extensions =
+ buildout.dumppickedversions
+ mr.developer
-sources = sources
-auto-checkout =
- grokcore.traverser
-
-[sources]
-grokcore.traverser = svn http://svn.zope.org/repos/main/grokcore.traverser/trunk
-
-
-[omelette]
-recipe = collective.recipe.omelette
-eggs = ${test:eggs}
-
[versions]
grokcore.rest =
[test]
recipe = zc.recipe.testrunner
eggs =
- grokcore.rest
- grokcore.rest[test]
+ grokcore.rest
+ grokcore.rest[test]
defaults = ['--tests-pattern', '^f?tests$', '-v', '-c']
+
+[omelette]
+recipe = collective.recipe.omelette
+eggs = ${test:eggs}
Modified: grokcore.rest/trunk/setup.py
===================================================================
--- grokcore.rest/trunk/setup.py 2011-01-18 11:13:48 UTC (rev 119640)
+++ grokcore.rest/trunk/setup.py 2011-01-18 13:06:32 UTC (rev 119641)
@@ -19,8 +19,8 @@
'zope.testing',
'zope.app.wsgi',
'zope.app.appsetup',
- 'zope.app.exception',
- 'zope.app.http',
+# 'zope.app.exception',
+# 'zope.app.http',
'grokcore.content',
]
Modified: grokcore.rest/trunk/src/grokcore/rest/configure.zcml
===================================================================
--- grokcore.rest/trunk/src/grokcore/rest/configure.zcml 2011-01-18 11:13:48 UTC (rev 119640)
+++ grokcore.rest/trunk/src/grokcore/rest/configure.zcml 2011-01-18 13:06:32 UTC (rev 119641)
@@ -1,26 +1,42 @@
<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- xmlns:grok="http://namespaces.zope.org/grok">
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:grok="http://namespaces.zope.org/grok">
<include file="meta.zcml" />
<!-- we register a ++rest++ traversal namespace -->
<adapter
- factory=".rest.rest_skin"
- for="* zope.publisher.interfaces.browser.IHTTPRequest"
- provides="zope.traversing.interfaces.ITraversable"
- name="rest"
- />
+ factory=".rest.rest_skin"
+ for="* zope.publisher.interfaces.browser.IHTTPRequest"
+ provides="zope.traversing.interfaces.ITraversable"
+ name="rest"
+ />
<publisher
- name="HTTP"
- factory=".publication.GrokHTTPFactory"
- methods="*"
- mimetypes="*"
- priority="1"
- />
+ name="HTTP"
+ factory=".publication.GrokHTTPFactory"
+ methods="*"
+ mimetypes="*"
+ priority="1"
+ />
<grok:grok package=".rest" />
+ <!--
+ XXX temporary registrations copied from zope.app.http.exception;
+ awaiting a [zope|grokcore].errorview package.
+ -->
+ <browser:defaultView
+ for="zope.security.interfaces.IUnauthorized"
+ layer="zope.publisher.interfaces.http.IHTTPRequest"
+ name="index.html"
+ />
+
+ <browser:defaultView
+ for="zope.publisher.interfaces.http.IMethodNotAllowed"
+ layer="zope.publisher.interfaces.http.IHTTPRequest"
+ name="index.html"
+ />
+
</configure>
Modified: grokcore.rest/trunk/src/grokcore/rest/ftesting.zcml
===================================================================
--- grokcore.rest/trunk/src/grokcore/rest/ftesting.zcml 2011-01-18 11:13:48 UTC (rev 119640)
+++ grokcore.rest/trunk/src/grokcore/rest/ftesting.zcml 2011-01-18 13:06:32 UTC (rev 119641)
@@ -5,15 +5,12 @@
i18n_domain="grokcore.rest"
package="grokcore.rest">
-
<include package="zope.securitypolicy" />
<include package="zope.annotation" />
<include package="grokcore.view" file="ftesting.zcml" />
<include package="grokcore.view" file="publication_security.zcml" />
<include package="grokcore.rest" />
- <include package="zope.app.http.exception" />
-
<browser:defaultView name="index.html" />
<grok:grok package=".ftests" />
Modified: grokcore.rest/trunk/src/grokcore/rest/ftests/rest/rest.py
===================================================================
--- grokcore.rest/trunk/src/grokcore/rest/ftests/rest/rest.py 2011-01-18 11:13:48 UTC (rev 119640)
+++ grokcore.rest/trunk/src/grokcore/rest/ftests/rest/rest.py 2011-01-18 13:06:32 UTC (rev 119641)
@@ -5,7 +5,7 @@
>>> from zope.component import getMultiAdapter
>>> from grokcore.rest.rest import GrokMethodNotAllowed
- >>> erview = getMultiAdapter((GrokMethodNotAllowed(None, None),
+ >>> erview = getMultiAdapter((GrokMethodNotAllowed(None, None),
... TestRequest()), name="index.html")
>>> erview
@@ -173,20 +173,44 @@
POST, PUT and DELETE however are not public::
- >>> print http('POST /++rest++e/app/alpha HTTP/1.1')
+ >>> print http('POST /++rest++e/app/alpha HTTP/1.1', handle_errors=False)
+ Traceback (most recent call last):
+ ...
+ Unauthorized: (<grokcore.rest.meta.SecurityRest object at 0x...>,
+ '__call__', 'zope.ManageContent')
+
+ XXX handle_errors should be set to True once we have a
+ [zope|grokcore].errorview package.
+
HTTP/1.0 401 Unauthorized
Content-Length: 0
Content-Type: text/plain
WWW-Authenticate: basic realm="Zope"
<BLANKLINE>
- >>> print http('PUT /++rest++e/app/alpha HTTP/1.1')
+ >>> print http('PUT /++rest++e/app/alpha HTTP/1.1', handle_errors=False)
+ Traceback (most recent call last):
+ ...
+ Unauthorized: (<grokcore.rest.meta.SecurityRest object at 0x...>,
+ '__call__', 'zope.ManageContent')
+
+ XXX handle_errors should be set to True once we have a
+ [zope|grokcore].errorview package.
+
HTTP/1.0 401 Unauthorized
Content-Length: 0
WWW-Authenticate: basic realm="Zope"
<BLANKLINE>
- >>> print http('DELETE /++rest++e/app/alpha HTTP/1.1')
+ >>> print http('DELETE /++rest++e/app/alpha HTTP/1.1', handle_errors=False)
+ Traceback (most recent call last):
+ ...
+ Unauthorized: (<grokcore.rest.meta.SecurityRest object at 0x...>,
+ '__call__', 'zope.ManageContent')
+
+ XXX handle_errors should be set to True once we have a
+ [zope|grokcore].errorview package.
+
HTTP/1.0 401 Unauthorized
Content-Length: 0
WWW-Authenticate: basic realm="Zope"
@@ -234,7 +258,15 @@
We shouldn't be allowed to PUT either::
- >>> print http('PUT /app/beta HTTP/1.1')
+ >>> print http('PUT /app/beta HTTP/1.1', handle_errors=False)
+ Traceback (most recent call last):
+ ...
+ NotFound: Object: <grokcore.rest.ftests.rest.rest.MyApp object at 0x...>,
+ name: u'beta'
+
+ XXX handle_errors should be set to True once we have a
+ [zope|grokcore].errorview package.
+
HTTP/1.0 404 Not Found
Content-Length: 0
Modified: grokcore.rest/trunk/src/grokcore/rest/rest.py
===================================================================
--- grokcore.rest/trunk/src/grokcore/rest/rest.py 2011-01-18 11:13:48 UTC (rev 119640)
+++ grokcore.rest/trunk/src/grokcore/rest/rest.py 2011-01-18 13:06:32 UTC (rev 119641)
@@ -15,8 +15,7 @@
from zope.traversing.interfaces import TraversalError
from zope.traversing.namespace import view
from zope.interface import Interface
-from zope.publisher.interfaces.http import IHTTPRequest
-from zope.app.publication.http import MethodNotAllowed
+from zope.publisher.interfaces.http import IHTTPRequest, MethodNotAllowed
from zope.publisher.browser import applySkin
@@ -64,7 +63,6 @@
self.request.response.setStatus(405)
return 'Method Not Allowed'
-
class rest_skin(view):
"""A rest skin.
More information about the checkins
mailing list