From c24e819b172a60f1cd844f1100ea64a42c57475a Mon Sep 17 00:00:00 2001 From: Rob Miller Date: Mon, 2 May 2011 13:31:18 -0700 Subject: [PATCH] log a warning if a controller action returns unicode instead of a string --- services/baseapp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/baseapp.py b/services/baseapp.py index 5a5ef9c..56e7abc 100644 --- a/services/baseapp.py +++ b/services/baseapp.py @@ -216,7 +216,11 @@ class SyncServerApp(object): elif isinstance(result, str): response.body = result else: - # if it's not str it's unicode + # if it's not str it's unicode, which really shouldn't happen + module = getattr(function, '__module__', 'unknown') + name = getattr(function, '__name__', 'unknown') + logger.warn('Unicode response returned from: %s - %s' + % (module, name)) response.unicode_body = result else: # result is already a Response