From 6c7b9a1534d35aeb07f4a9a59b8e15633f6b6b6b Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 31 May 2009 20:36:53 +0000 Subject: - 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``. --- repoze/bfg/request.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'repoze/bfg/request.py') 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, + } + -- cgit v1.2.3