handlers.py 文件源码

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

项目:django-secure-mail 作者: blag 项目源码 文件源码
def get_variable_from_exception(exception, variable_name):
    """
    Grab the variable from closest frame in the stack
    """
    for frame in reversed(trace()):
        try:
            # From http://stackoverflow.com/a/9059407/6461688
            frame_variable = frame[0].f_locals[variable_name]
        except KeyError:
            pass
        else:
            return frame_variable
    else:
        raise KeyError("Variable '%s' not in any stack frames", variable_name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号