[Checkins] SVN: grok/trunk/ Following negotiation with Jan-Wijbrand Kolman on the Grok mailing list,
Brandon Rhodes
brandon at rhodesmill.org
Fri Jan 2 12:42:09 EST 2009
Log message for revision 94451:
Following negotiation with Jan-Wijbrand Kolman on the Grok mailing list,
I have changed the new IRESTRequest class to IRESTLayer, since this
seems to make user code easier to read. This can be seen in the tests:
the class is used to create things called "Layer", and the class is also
passed as an argument to grok.layer(), so the name makes sense in both
contexts. I have not, however, attempted to rename IBrowserRequest,
because I think that his objections to that change are good ones for now
(in particular, that grokcore.view is beyond 1.0).
Changed:
U grok/trunk/CHANGES.txt
U grok/trunk/doc/upgrade.txt
U grok/trunk/src/grok/__init__.py
U grok/trunk/src/grok/components.py
U grok/trunk/src/grok/ftests/rest/localgrants.py
U grok/trunk/src/grok/ftests/rest/rest.py
U grok/trunk/src/grok/ftests/rest/rest_traverse.py
U grok/trunk/src/grok/interfaces.py
U grok/trunk/src/grok/meta.py
U grok/trunk/src/grok/rest.py
U grok/trunk/src/grok/tests/conflict/rest.py
-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/CHANGES.txt 2009-01-02 17:42:09 UTC (rev 94451)
@@ -16,7 +16,7 @@
* 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 IRESTRequest base
+ that can be used on REST layer interfaces. Introduced the IRESTLayer base
interfaces for defining REST layers.
Bug fixes
Modified: grok/trunk/doc/upgrade.txt
===================================================================
--- grok/trunk/doc/upgrade.txt 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/doc/upgrade.txt 2009-01-02 17:42:09 UTC (rev 94451)
@@ -21,10 +21,10 @@
You can now simply write::
- class IMyLayer(grok.IRESTRequest):
+ class IMyLayer(grok.IRESTLayer):
grok.restskin('myskin')
- As you can see, ``IRESTRequest`` has been introduced as a baseclass for
+ As you can see, ``IRESTLayer`` has been introduced as a baseclass for
defining REST layers.
Modified: grok/trunk/src/grok/__init__.py
===================================================================
--- grok/trunk/src/grok/__init__.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/__init__.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -73,7 +73,7 @@
from grok.components import Application, Form, AddForm, EditForm, DisplayForm
from grok.components import Indexes
from grok.components import Role
-from grok.interfaces import IRESTSkinType, IRESTRequest
+from grok.interfaces import IRESTSkinType, IRESTLayer
from grok.directive import (
local_utility, permissions, site, restskin, traversable)
Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/components.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -193,7 +193,7 @@
# if we have a RESTful request, we will handle
# GET, POST and HEAD differently (PUT and DELETE are handled already
# but not on the BrowserRequest layer but the HTTPRequest layer)
- if interfaces.IRESTRequest.providedBy(request):
+ if interfaces.IRESTLayer.providedBy(request):
rest_view = component.getMultiAdapter(
(self.context, self.request), name=request.method)
return rest_view, ()
Modified: grok/trunk/src/grok/ftests/rest/localgrants.py
===================================================================
--- grok/trunk/src/grok/ftests/rest/localgrants.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/ftests/rest/localgrants.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -57,7 +57,7 @@
def __init__(self, name):
self.name = name
-class MammothRestLayer(grok.IRESTRequest):
+class MammothRestLayer(grok.IRESTLayer):
grok.restskin('mammoth')
class TouchMammoth(grok.Permission):
Modified: grok/trunk/src/grok/ftests/rest/rest.py
===================================================================
--- grok/trunk/src/grok/ftests/rest/rest.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/ftests/rest/rest.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -302,25 +302,25 @@
class MyContent(grok.Model):
pass
-class LayerA(grok.IRESTRequest):
+class LayerA(grok.IRESTLayer):
grok.restskin('a')
-class LayerB(grok.IRESTRequest):
+class LayerB(grok.IRESTLayer):
grok.restskin('b')
-class LayerC(grok.IRESTRequest):
+class LayerC(grok.IRESTLayer):
grok.restskin('c')
-class LayerSecurity(grok.IRESTRequest):
+class LayerSecurity(grok.IRESTLayer):
grok.restskin('e')
-class LayerContent(grok.IRESTRequest):
+class LayerContent(grok.IRESTLayer):
grok.restskin('f')
-class LayerInterface(grok.IRESTRequest):
+class LayerInterface(grok.IRESTLayer):
grok.restskin('g')
-class D(grok.IRESTRequest):
+class D(grok.IRESTLayer):
grok.restskin('d')
class ARest(grok.REST):
Modified: grok/trunk/src/grok/ftests/rest/rest_traverse.py
===================================================================
--- grok/trunk/src/grok/ftests/rest/rest_traverse.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/ftests/rest/rest_traverse.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -77,7 +77,7 @@
if 'sub':
return MyContent()
-class LayerZ(grok.IRESTRequest):
+class LayerZ(grok.IRESTLayer):
grok.restskin('layerz')
class ZContentRest(grok.REST):
Modified: grok/trunk/src/grok/interfaces.py
===================================================================
--- grok/trunk/src/grok/interfaces.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/interfaces.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -200,7 +200,7 @@
index for interface or class context.
"""
-class IRESTRequest(IHTTPRequest):
+class IRESTLayer(IHTTPRequest):
"""REST-specific Request functionality.
Base Interfaces for defining REST-layers.
Modified: grok/trunk/src/grok/meta.py
===================================================================
--- grok/trunk/src/grok/meta.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/meta.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -133,7 +133,7 @@
"""
martian.component(grok.REST)
martian.directive(grok.context)
- martian.directive(grok.layer, default=grok.IRESTRequest)
+ martian.directive(grok.layer, default=grok.IRESTLayer)
martian.directive(grok.require, name='permission')
def execute(self, factory, method, config, permission, context,
@@ -164,7 +164,7 @@
class RestskinInterfaceDirectiveGrokker(martian.InstanceGrokker):
"""Grokker for interfaces providing the `grok.restskin()` directive.
- Applications create REST skins by subclassing `grok.IRESTRequest`
+ Applications create REST skins by subclassing `grok.IRESTLayer`
and providing the subclass with a `grok.restskin()` directive giving
the prefix string which distinguishes that REST layers from others.
This grokker registers those skins.
@@ -185,11 +185,11 @@
# interface.
return False
- if not interface.extends(grok.IRESTRequest):
- # For REST layers it is required to extend IRESTRequest.
+ if not interface.extends(grok.IRESTLayer):
+ # For REST layers it is required to extend IRESTLayer.
raise GrokError(
"The grok.restskin() directive is used on interface %r. "
- "However, %r does not extend IRESTRequest which is "
+ "However, %r does not extend IRESTLayer which is "
"required for interfaces that are used as layers and are to "
"be registered as a restskin."
% (interface.__identifier__, interface.__identifier__),
Modified: grok/trunk/src/grok/rest.py
===================================================================
--- grok/trunk/src/grok/rest.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/rest.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -90,7 +90,7 @@
clients attempt to assail them with unwanted HTTP methods.
"""
- grok.layer(grok.IRESTRequest)
+ grok.layer(grok.IRESTLayer)
grok.context(Interface)
is_not_allowed = True
Modified: grok/trunk/src/grok/tests/conflict/rest.py
===================================================================
--- grok/trunk/src/grok/tests/conflict/rest.py 2009-01-02 13:17:37 UTC (rev 94450)
+++ grok/trunk/src/grok/tests/conflict/rest.py 2009-01-02 17:42:09 UTC (rev 94451)
@@ -10,8 +10,8 @@
import grok
-class Protocol1(grok.IRESTRequest):
+class Protocol1(grok.IRESTLayer):
grok.restskin('foo')
-class Protocol2(grok.IRESTRequest):
+class Protocol2(grok.IRESTLayer):
grok.restskin('foo')
More information about the Checkins
mailing list