summaryrefslogtreecommitdiff
path: root/repoze/bfg/request.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-31 20:36:53 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-31 20:36:53 +0000
commit6c7b9a1534d35aeb07f4a9a59b8e15633f6b6b6b (patch)
tree184f1553b041226cac7e8a83b71578e556e15874 /repoze/bfg/request.py
parent8c3b807625d0480c7ce934bf7daf3437328346bf (diff)
downloadpyramid-6c7b9a1534d35aeb07f4a9a59b8e15633f6b6b6b.tar.gz
pyramid-6c7b9a1534d35aeb07f4a9a59b8e15633f6b6b6b.tar.bz2
pyramid-6c7b9a1534d35aeb07f4a9a59b8e15633f6b6b6b.zip
- The ``request_type`` argument of ZCML ``view`` declarations and
``bfg_view`` decorators can now be one of the strings ``GET``, ``POST``, ``PUT``, ``DELETE``, or ``HEAD`` instead of a reference to the respective interface type imported from ``repoze.bfg.interfaces``.
Diffstat (limited to 'repoze/bfg/request.py')
-rw-r--r--repoze/bfg/request.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/repoze/bfg/request.py b/repoze/bfg/request.py
index de5711e0a..44a232d0d 100644
--- a/repoze/bfg/request.py
+++ b/repoze/bfg/request.py
@@ -21,8 +21,8 @@ class Request(WebobRequest):
# an optimization (e.g. preventing calls to ``alsoProvides`` means the
# difference between 590 r/s and 690 r/s on a MacBook 2GHz). These
# classes are *not* APIs. None of these classes, nor the
-# ``HTTP_METHOD_FACTORIES`` lookup dict should be imported directly by
-# user code.
+# ``HTTP_METHOD_FACTORIES`` or ``HTTP_METHOD_INTERFACES`` lookup dicts
+# should be imported directly by user code.
class GETRequest(WebobRequest):
implements(repoze.bfg.interfaces.IGETRequest)
@@ -52,3 +52,11 @@ HTTP_METHOD_FACTORIES = {
'HEAD':HEADRequest,
}
+HTTP_METHOD_INTERFACES = {
+ 'GET':repoze.bfg.interfaces.IGETRequest,
+ 'POST':repoze.bfg.interfaces.IPOSTRequest,
+ 'PUT':repoze.bfg.interfaces.IPUTRequest,
+ 'DELETE':repoze.bfg.interfaces.IDELETERequest,
+ 'HEAD':repoze.bfg.interfaces.IHEADRequest,
+ }
+