#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def on_POST( self , request , user_id ) : #NEWLINE# #INDENT# target_user = UserID . from_string ( user_id ) #NEWLINE# requester = ( yield self . auth . get_user_by_req ( request ) ) #NEWLINE# if ( target_user != content . user ) : #NEWLINE# #INDENT# raise AuthError ( 403 , 'Cannot create filters for other users' ) #NEWLINE# #UNINDENT# if ( not self . hs . is_mine ( target_user ) ) : #NEWLINE# #INDENT# raise SynapseError ( 400 , 'Can only create filters for local users' ) #NEWLINE# #UNINDENT# content = parse_json_object_from_request ( request ) #NEWLINE# filter_id = ( yield self . filtering . add_user_filter ( user_localpart = target_user . localpart , user_filter = content ) ) #NEWLINE# defer . returnValue ( ( 200 , { #NEWLINE# #INDENT# 'filter_id' : str ( filter_id ) , #NEWLINE# #UNINDENT# } ) )