aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/utils/__init__.py
diff options
context:
space:
mode:
authorSébastien Piquemal2012-02-02 18:19:44 +0200
committerSébastien Piquemal2012-02-02 18:19:44 +0200
commit5bb6301b7f53e3815ab1a81a5fa38721dc95b113 (patch)
tree27d53698a374ac62c4a3be41b23173775c92f207 /djangorestframework/utils/__init__.py
parent5f59d90645dfddc293bbbbc4ca9b4c3f3125b590 (diff)
downloaddjango-rest-framework-5bb6301b7f53e3815ab1a81a5fa38721dc95b113.tar.bz2
Response as a subclass of HttpResponse - first draft, not quite there yet.
Diffstat (limited to 'djangorestframework/utils/__init__.py')
-rw-r--r--djangorestframework/utils/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/djangorestframework/utils/__init__.py b/djangorestframework/utils/__init__.py
index 634d0d68..fbe55474 100644
--- a/djangorestframework/utils/__init__.py
+++ b/djangorestframework/utils/__init__.py
@@ -48,6 +48,13 @@ def url_resolves(url):
return True
+def allowed_methods(view):
+ """
+ Return the list of uppercased allowed HTTP methods on `view`.
+ """
+ return [method.upper() for method in view.http_method_names if hasattr(view, method)]
+
+
# From http://www.koders.com/python/fidB6E125C586A6F49EAC38992CF3AFDAAE35651975.aspx?s=mdef:xml
#class object_dict(dict):
# """object view of dict, you can