view_utils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:helios-server-mixnet 作者: RunasSudo 项目源码 文件源码
def return_json(func):
    """
    A decorator that serializes the output to JSON before returning to the
    web client.
    """
    def convert_to_json(self, *args, **kwargs):
      return_val = func(self, *args, **kwargs)
      try:
        return render_json(utils.to_json(return_val))
      except Exception, e:
        import logging
        logging.error("problem with serialization: " + str(return_val) + " / " + str(e))
        raise e

    return update_wrapper(convert_to_json,func)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号