aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/oauth/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/oauth/views.py')
-rw-r--r--mediagoblin/oauth/views.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/mediagoblin/oauth/views.py b/mediagoblin/oauth/views.py
index 90ad5bbf..1b7c789a 100644
--- a/mediagoblin/oauth/views.py
+++ b/mediagoblin/oauth/views.py
@@ -15,7 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
-import string
+
+import six
from oauthlib.oauth1.rfc5849.utils import UNICODE_ASCII_CHARACTER_SET
from oauthlib.oauth1 import (RequestTokenEndpoint, AuthorizationEndpoint,
@@ -124,21 +125,21 @@ def client_register(request):
error = "Invalid registration type"
return json_response({"error": error}, status=400)
- logo_url = data.get("logo_url", client.logo_url)
- if logo_url is not None and not validate_url(logo_url):
- error = "Logo URL {0} is not a valid URL.".format(logo_url)
+ logo_uri = data.get("logo_uri", client.logo_url)
+ if logo_uri is not None and not validate_url(logo_uri):
+ error = "Logo URI {0} is not a valid URI.".format(logo_uri)
return json_response(
{"error": error},
status=400
)
else:
- client.logo_url = logo_url
+ client.logo_url = logo_uri
client.application_name = data.get("application_name", None)
contacts = data.get("contacts", None)
if contacts is not None:
- if type(contacts) is not unicode:
+ if not isinstance(contacts, six.text_type):
error = "Contacts must be a string of space-seporated email addresses."
return json_response({"error": error}, status=400)
@@ -154,7 +155,7 @@ def client_register(request):
redirect_uris = data.get("redirect_uris", None)
if redirect_uris is not None:
- if type(redirect_uris) is not unicode:
+ if not isinstance(redirect_uris, six.text_type):
error = "redirect_uris must be space-seporated URLs."
return json_response({"error": error}, status=400)
@@ -189,10 +190,6 @@ def request_token(request):
error = "Could not decode data."
return json_response({"error": error}, status=400)
- if data == "":
- error = "Unknown Content-Type"
- return json_response({"error": error}, status=400)
-
if not data and request.headers:
data = request.headers