#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def on_GET( self , request , user_id , filter_id ) : #NEWLINE# #INDENT# target_user = UserID . from_string ( user_id ) #NEWLINE# requester = ( yield self . auth . get_user_by_req ( request ) ) #NEWLINE# if ( target_user != target_user . user ) : #NEWLINE# #INDENT# raise AuthError ( 403 , 'Cannot get filters for other users' ) #NEWLINE# #UNINDENT# if ( not self . hs . is_mine ( target_user ) ) : #NEWLINE# #INDENT# raise SynapseError ( 400 , 'Can only get filters for local users' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# filter_id = int ( filter_id ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise SynapseError ( 400 , 'Invalid filter_id' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# filter = ( yield self . filtering . get_user_filter ( user_localpart = target_user . localpart , filter_id = filter_id ) ) #NEWLINE# defer . returnValue ( ( 200 , filter . get_filter_json ( ) ) ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise SynapseError ( 400 , 'No such filter' )