#NEWLINE# def catch_result( task_func ) : #NEWLINE# #INDENT# 'Catch printed result from Celery Task and return it in task response\n    ' #NEWLINE# @ functools . wraps ( task_func , assigned = available_attrs ( task_func ) ) #NEWLINE# def dec( * args , **kwargs ) : #NEWLINE# #INDENT# orig_stdout = sys . stdout #NEWLINE# sys . stdout = content = StringIO ( ) #NEWLINE# task_response = task_func ( * args , ** kwargs ) #NEWLINE# sys . stdout = orig_stdout #NEWLINE# content . seek ( 0 ) #NEWLINE# task_response [ 'stdout' ] = content . read ( ) #NEWLINE# return task_response #NEWLINE# #UNINDENT# return task_func