[Checkins] SVN: grok/branches/faassen-rest/src/grok/ Instead of
causing subsequent traversal, get REST view directly, which
Martijn Faassen
faassen at infrae.com
Mon Sep 24 11:46:12 EDT 2007
Log message for revision 79883:
Instead of causing subsequent traversal, get REST view directly, which
should produce nicer URL behavior.
Changed:
U grok/branches/faassen-rest/src/grok/components.py
U grok/branches/faassen-rest/src/grok/ftests/rest/rest.py
-=-
Modified: grok/branches/faassen-rest/src/grok/components.py
===================================================================
--- grok/branches/faassen-rest/src/grok/components.py 2007-09-24 15:35:34 UTC (rev 79882)
+++ grok/branches/faassen-rest/src/grok/components.py 2007-09-24 15:46:11 UTC (rev 79883)
@@ -299,8 +299,10 @@
# GET, POST and HEAD differently (PUT and DELETE are handled already
# but not on the BrowserRequest layer but the HTTPRequest layer)
if IRESTLayer.providedBy(request):
- view_uri = '@@%s' % request.method
- return self.context, (view_uri,)
+ rest_view = component.getMultiAdapter(
+ (self.context, self.request),
+ name=request.method)
+ return rest_view, ()
view_name = getDefaultViewName(self.context, request)
view_uri = "@@%s" % view_name
return self.context, (view_uri,)
Modified: grok/branches/faassen-rest/src/grok/ftests/rest/rest.py
===================================================================
--- grok/branches/faassen-rest/src/grok/ftests/rest/rest.py 2007-09-24 15:35:34 UTC (rev 79882)
+++ grok/branches/faassen-rest/src/grok/ftests/rest/rest.py 2007-09-24 15:46:11 UTC (rev 79883)
@@ -53,7 +53,7 @@
Traceback (most recent call last):
...
GrokMethodNotAllowed: <grok.ftests.rest.rest.MyApp object at ...>,
- <zope.publisher.browser.BrowserRequest instance URL=http://localhost/++rest++b/app/@@POST>
+ <zope.publisher.browser.BrowserRequest instance URL=http://localhost/++rest++b/app>
DELETE is also not defined, so we also expect a 405 error::
@@ -144,9 +144,6 @@
Todo:
-* MethodNotAllowed error URLs for GET and POST have @@GET and @@POST
- attached. Not pretty.
-
* Support for OPTIONS, HEAD, other methods?
* Content-Type header is there for GET/POST, but not for PUT/DELETE...
More information about the Checkins
mailing list