alfredodeza / pecan-notario

A notario schema decorator for Pecan
BSD 3-Clause "New" or "Revised" License
1 stars 4 forks source link

WebOb 1.7 compatibility #6

Open ktdreyer opened 6 years ago

ktdreyer commented 6 years ago

The pecan-notario tests fail with WebOb 1.7 (shipping in Fedora 29), TypeError: You cannot set the body to a text value without a charset.

Might be as simple as this (untested):

diff --git a/pecan_notario/exceptions.py b/pecan_notario/exceptions.py
index ac77ea4..002f090 100644
--- a/pecan_notario/exceptions.py
+++ b/pecan_notario/exceptions.py
@@ -23,7 +23,7 @@ class JSONValidationException(WSGIHTTPException):
         content_type = 'application/json'
         body = '{"error": "%s"}' % self.detail
         resp = Response(
-            body,
+            text=body,
             status=self.status,
             headerlist=headerlist,
             content_type=content_type
ktdreyer commented 6 years ago

https://bugzilla.redhat.com/show_bug.cgi?id=1424182

ktdreyer commented 6 years ago

The above patch allows the tests to pass on Fedora. PR at https://github.com/alfredodeza/pecan-notario/pull/7