From 81e0735ce0da622932fb56c6dd7c08bb4a277df6 Mon Sep 17 00:00:00 2001 From: Sjoerd Arendsen Date: Wed, 10 Feb 2016 12:48:58 +0100 Subject: [PATCH] Force method names to string. --- rest_framework_docs/api_endpoint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework_docs/api_endpoint.py b/rest_framework_docs/api_endpoint.py index 26cb0f6..d6a3a45 100644 --- a/rest_framework_docs/api_endpoint.py +++ b/rest_framework_docs/api_endpoint.py @@ -1,6 +1,7 @@ import json import inspect from django.contrib.admindocs.views import simplify_regex +from django.utils.encoding import force_str class ApiEndpoint(object): @@ -25,7 +26,7 @@ def __get_path__(self, parent_pattern): return simplify_regex(self.pattern.regex.pattern) def __get_allowed_methods__(self): - return [m.upper() for m in self.callback.cls.http_method_names if hasattr(self.callback.cls, m)] + return [force_str(m).upper() for m in self.callback.cls.http_method_names if hasattr(self.callback.cls, m)] def __get_docstring__(self): return inspect.getdoc(self.callback)