#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def on_GET( self , request , room_id , event_id ) : #NEWLINE# #INDENT# requester = ( yield self . auth . get_user_by_req ( request , allow_guest = True ) ) #NEWLINE# limit = int ( request . args . get ( 'limit' , [ 10 ] ) [ 0 ] ) #NEWLINE# results = ( yield self . handlers . room_context_handler . get_event_context ( requester . user , room_id , event_id , limit , requester . is_guest ) ) #NEWLINE# if ( not results ) : #NEWLINE# #INDENT# raise SynapseError ( 404 , 'Event not found.' , errcode = Codes . NOT_FOUND ) #NEWLINE# #UNINDENT# time_now = self . clock . time_msec ( ) #NEWLINE# results [ 'events_before' ] = [ serialize_event ( event , time_now ) for event in results [ 'events_before' ] ] #NEWLINE# results [ 'event' ] = serialize_event ( results [ 'event' ] , time_now ) #NEWLINE# results [ 'events_after' ] = [ serialize_event ( event , time_now ) for event in results [ 'events_after' ] ] #NEWLINE# results [ 'state' ] = [ serialize_event ( event , time_now ) for event in results [ 'state' ] ] #NEWLINE# defer . returnValue ( ( 200 , results ) )