web_server.py 文件源码

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

项目:shakecast 作者: usgs 项目源码 文件源码
def get_notification(event_id):
    session = Session()
    event = session.query(Event).filter(Event.event_id == event_id).first()

    dicts = []
    if event is not None:
        nots = event.notifications
        for sm in event.shakemaps:
            nots += sm.notifications

        for obj in nots:
            dict_ = obj.__dict__.copy()
            dict_.pop('_sa_instance_state', None)
            dict_['group_name'] = obj.group.name
            dicts += [dict_]

    json_ = json.dumps(dicts, cls=AlchemyEncoder)
    Session.remove()    
    return json_
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号