Browse Source

Make DebugFilesKeyError.__str__ return str on 3.x

pull/739/merge
Daniel Neuhäuser 12 years ago
parent
commit
4bea6bbe6d
  1. 4
      flask/debughelpers.py

4
flask/debughelpers.py

@ -8,6 +8,7 @@
:copyright: (c) 2011 by Armin Ronacher. :copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from flask._compat import implements_to_string
class UnexpectedUnicodeError(AssertionError, UnicodeError): class UnexpectedUnicodeError(AssertionError, UnicodeError):
@ -16,6 +17,7 @@ class UnexpectedUnicodeError(AssertionError, UnicodeError):
""" """
@implements_to_string
class DebugFilesKeyError(KeyError, AssertionError): class DebugFilesKeyError(KeyError, AssertionError):
"""Raised from request.files during debugging. The idea is that it can """Raised from request.files during debugging. The idea is that it can
provide a better error message than just a generic KeyError/BadRequest. 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. ' buf.append('\n\nThe browser instead transmitted some file names. '
'This was submitted: %s' % ', '.join('"%s"' % x 'This was submitted: %s' % ', '.join('"%s"' % x
for x in form_matches)) for x in form_matches))
self.msg = ''.join(buf).encode('utf-8') self.msg = ''.join(buf)
def __str__(self): def __str__(self):
return self.msg return self.msg

Loading…
Cancel
Save