From cbef2f3daefde8c0e047e0b3deafad609e89e624 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Sat, 9 Mar 2013 00:07:21 -0800 Subject: [PATCH] Add support for PUT and DELETE requests. --- r2/r2/controllers/api_docs.py | 3 ++- r2/r2/controllers/error.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/r2/r2/controllers/api_docs.py b/r2/r2/controllers/api_docs.py index fea198184..68b093fe0 100644 --- a/r2/r2/controllers/api_docs.py +++ b/r2/r2/controllers/api_docs.py @@ -125,8 +125,9 @@ class ApidocsController(RedditController): if not action: continue + valid_methods = ('GET', 'POST', 'PUT', 'DELETE') api_doc = getattr(func, '_api_doc', None) - if api_doc and 'section' in api_doc and method in ('GET', 'POST'): + if api_doc and 'section' in api_doc and method in valid_methods: docs = {} docs['doc'] = inspect.getdoc(func) diff --git a/r2/r2/controllers/error.py b/r2/r2/controllers/error.py index 668727f1c..1ce86536b 100644 --- a/r2/r2/controllers/error.py +++ b/r2/r2/controllers/error.py @@ -205,7 +205,7 @@ class ErrorController(RedditController): except Exception as e: return handle_awful_failure("ErrorController.GET_document: %r" % e) - POST_document = GET_document + POST_document = PUT_document = DELETE_document = GET_document def handle_awful_failure(fail_text): """