REST support in Grok
Doc review project
Blueprint information
Related branches
Related bugs
Sprints
Whiteboard
P. Wilson : Began review process.
* Can see error already with old style REST suppot via
class AtomPubProtocol
grok.
grok.
whereas the Grok changelog states that:
"Similar to the layers and skins restructuring, the grok.RESTProtocol baseclass has been removed in favour of a grok.restskin(name) directive that can be used on REST layer interfaces. Introduced the IRESTLayer base interfaces for defining REST layers."
Fixing the example requires removing the above class and adding:
grok.restskin(
to the AtomPubLayer defined.
Additional Thoughts
==============
* A more realistic example where headers are correctly set might be useful.
* Would be useful to show the doctest update required to test this rest interface, e.g.:
~~~~~~~
Do a functional doctest test on the app.
=======
:Test-Layer: functional
Let's first create an instance of Grok_doc_tests at the top level:
>>> from grok_doc_tests.app import Grok_doc_tests, MyContainer
>>> root = getRootFolder()
>>> root['app'] = Grok_doc_tests()
>>> root['app'
Run tests in the testbrowser
-------
The zope.testbrowse
simulates a web browser similar to Mozilla Firefox or IE. We use that
to test how our application behaves in a browser. For more
information, see http://
Create a browser and visit the instance you just created:
>>> from zope.testbrowse
>>> browser = Browser()
>>> browser.open('http://
Check some basic information about the page you visit:
>>> browser.url
'http://
>>> browser.
'200 OK'
~~~~~~~
* Can see possibility for expansion to cover applying default skins to remove ++rest++:
@grok.subscribe( ... , grok.IBeforeTra
def restSkin(obj, event):
if not RestAPILayer.
grok.
14th October 2009 - JW-Kolman requests expansion to detail how applying skins automatically affects requests to all subobjects of the traversed skinned object.