diff --git a/src/milla/app.py b/src/milla/app.py index 3469413..67e2392 100644 --- a/src/milla/app.py +++ b/src/milla/app.py @@ -40,6 +40,14 @@ __all__ = [ ] +try: + # In Python 2, it could be a str or a unicode object + _string = basestring +except NameError: + # In Python 3, we are only interested in str objects + _string = str + + class BaseApplication(object): '''Base class for Milla applications @@ -88,12 +96,6 @@ class BaseApplication(object): # The callable might have returned just a string, which is OK, # but we need to wrap it in a Response object - try: - # In Python 2, it could be a str or a unicode object - _string = basestring - except NameError: - # In Python 3, we are only interested in str objects - _string = str if isinstance(response, _string) or not response: response = request.ResponseClass(response)