app.py 文件源码

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

项目:lc_cloud 作者: refractionPOINT 项目源码 文件源码
def doGET( self ):
        params = web.input( atid = None )

        if params.atid is None:
            raise web.HTTPError( '400 Bad Request: atid required' )

        effectiveId = normalAtom( params.atid )

        info = model.request( 'get_atoms_from_root', { 'id' : effectiveId, 'with_routing' : True } )

        if not info.isSuccess:
            raise web.HTTPError( '503 Service Unavailable : %s' % str( info ) )

        info.data = list( info.data )

        for routing, _ in info.data:
            if not isOrgAllowed( AgentId( routing[ 'aid' ] ).org_id ):
                raise web.HTTPError( '401 Unauthorized' )

        # Make sure the root is present
        isFound = False
        for _, atom in info.data:
            if effectiveId == normalAtom( atom.values()[0]['hbs.THIS_ATOM'] ):
                isFound = True
                break
        info.data = map( lambda x: { 'data' : x[ 1 ], 'key' : EventInterpreter( x[ 1 ] ).shortKey() }, info.data )
        if not isFound:
            info.data.append( { 'data' : { 'UNKNOWN' : { 'hbs.THIS_ATOM' : effectiveId } },
                                'key' : 'UNKNOWN' } )

        # Summarize the events

        return info.data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号