util.py 文件源码

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

项目:t2-crash-reporter 作者: tessel 项目源码 文件源码
def update_crash_report(cls, fingerprint, delta_state):
        name = CrashReport.key_name(fingerprint)
        to_update = list()
        q = CrashReport.all()
        q.filter('name = ', name)
        for crash_report in q.run():
            # update state
            # only allow * mutable * properties of crash reports to be updated

            # having to manually update properties on the entity this was, as expando entities
            # do not have a way to update an entity via a property name :(
            if 'argv' in delta_state:
                crash_report.argv = delta_state.get('argv')
            if 'labels' in delta_state:
                crash_report.labels = delta_state.get('labels')
            if 'date_time' in delta_state:
                crash_report.date_time = delta_state.get('date_time')
            if 'count' in delta_state:
                crash_report.count = delta_state.get('count')
            if 'issue' in delta_state:
                crash_report.issue = delta_state.get('issue')
            if 'state' in delta_state:
                crash_report.state = delta_state.get('state')

            to_update.append(crash_report)

        # update datastore and search indexes
        db.put(to_update)
        Search.add_crash_reports(to_update)
        # clear memcache
        CrashReport.clear_properties_cache(name)
        # return crash report
        return CrashReport.get_crash(fingerprint)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号