log a warning if a controller action returns unicode instead of a string

This commit is contained in:
Rob Miller 2011-05-02 13:31:18 -07:00
Родитель 758f16c1a0
Коммит c24e819b17
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -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