except NotFound as exc:
return render_404(request)(environ, start_response)
except HTTPException as exc:
- # Support legacy webob.exc responses
+ # exceptions that match() is documented to return:
+ # MethodNotAllowed, RequestRedirect TODO: need to handle ???
return exc(environ, start_response)
view_func = view_functions[endpoint]
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import werkzeug.utils
-from webob import Response
+from werkzeug.wrappers import Response as wz_Response
from mediagoblin.tools.template import render_template
from mediagoblin.tools.translate import (lazy_pass_to_ugettext as _,
pass_to_ugettext)
+class Response(wz_Response):
+ """Set default response mimetype to HTML, otherwise we get text/plain"""
+ default_mimetype = u'text/html'
+
def render_to_response(request, template, context, status=200):
"""Much like Django's shortcut.render()"""