aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Spaeth <Sebastian@SSpaeth.de>2012-11-16 11:21:15 +0100
committerSebastian Spaeth <Sebastian@SSpaeth.de>2012-12-21 08:12:25 +0100
commit74af60bb32f9009b838f7acee73c9a6cca2be265 (patch)
treecaf42c66268d06101208a5e04f62865833b5d762
parentbf3b9e783dc86b38864e66c2aab149472e636461 (diff)
downloadmediagoblin-74af60bb32f9009b838f7acee73c9a6cca2be265.tar.lz
mediagoblin-74af60bb32f9009b838f7acee73c9a6cca2be265.tar.xz
mediagoblin-74af60bb32f9009b838f7acee73c9a6cca2be265.zip
replace webob.Response with werkzeug Response
Replace webob usage in one more file. Document a TODO that should be clarified, we should probably be using json_response rather than Response() here. Modify the TestMeddleware to not rely on the content_type attribute being present, while werkzeug.wrappers Response() has it the BaseResponse() object which is often returned in tests does not have it. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
-rw-r--r--mediagoblin/plugins/api/views.py6
-rw-r--r--mediagoblin/tests/tools.py2
2 files changed, 5 insertions, 3 deletions
diff --git a/mediagoblin/plugins/api/views.py b/mediagoblin/plugins/api/views.py
index 39f864c4..8e02d7bd 100644
--- a/mediagoblin/plugins/api/views.py
+++ b/mediagoblin/plugins/api/views.py
@@ -19,10 +19,10 @@ import logging
import uuid
from os.path import splitext
-from webob import Response
+from werkzeug.datastructures import FileStorage
from werkzeug.exceptions import BadRequest, Forbidden
from werkzeug.utils import secure_filename
-from werkzeug.datastructures import FileStorage
+from werkzeug.wrappers import Response
from celery import registry
from mediagoblin.db.util import ObjectId
@@ -136,6 +136,8 @@ def api_test(request):
'username': request.user.username,
'email': request.user.email}
+ # TODO: This is the *only* thing using Response() here, should that
+ # not simply use json_response()?
return Response(json.dumps(user_data))
diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py
index 8c09c7ec..0e923aee 100644
--- a/mediagoblin/tests/tools.py
+++ b/mediagoblin/tests/tools.py
@@ -78,7 +78,7 @@ class TestingMeddleware(BaseMeddleware):
def process_response(self, request, response):
# All following tests should be for html only!
- if response.content_type != "text/html":
+ if getattr(response, 'content_type', None) != "text/html":
# Get out early
return