From 4bea6bbe6d2200dfdbcca3dfc2fe561488c82a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Neuha=CC=88user?= Date: Wed, 22 May 2013 21:07:53 +0200 Subject: [PATCH] Make DebugFilesKeyError.__str__ return str on 3.x --- flask/debughelpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flask/debughelpers.py b/flask/debughelpers.py index 504fab93..f3bac185 100644 --- a/flask/debughelpers.py +++ b/flask/debughelpers.py @@ -8,6 +8,7 @@ :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ +from flask._compat import implements_to_string class UnexpectedUnicodeError(AssertionError, UnicodeError): @@ -16,6 +17,7 @@ class UnexpectedUnicodeError(AssertionError, UnicodeError): """ +@implements_to_string class DebugFilesKeyError(KeyError, AssertionError): """Raised from request.files during debugging. The idea is that it can provide a better error message than just a generic KeyError/BadRequest. @@ -33,7 +35,7 @@ class DebugFilesKeyError(KeyError, AssertionError): buf.append('\n\nThe browser instead transmitted some file names. ' 'This was submitted: %s' % ', '.join('"%s"' % x for x in form_matches)) - self.msg = ''.join(buf).encode('utf-8') + self.msg = ''.join(buf) def __str__(self): return self.msg