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
评论列表
文章目录