#NEWLINE# def sub_unique_objects( self , obj , params = None , pub = None , * args , **kwargs ) : #NEWLINE# #INDENT# 'Return objects that are only visible through given subscription.' #NEWLINE# if ( params is None ) : #NEWLINE# #INDENT# params = ejson . loads ( obj . params_ejson ) #NEWLINE# #UNINDENT# if ( pub is None ) : #NEWLINE# #INDENT# pub = self . get_pub_by_name ( obj . publication ) #NEWLINE# #UNINDENT# queries = collections . OrderedDict ( ( ( col , qs ) for ( qs , col ) in ( self . qs_and_collection ( qs ) for qs in pub . user_queries ( obj . user , * params ) ) ) ) #NEWLINE# to_send = collections . OrderedDict ( ( ( col , col . objects_for_user ( * args , user = obj . user_id , qs = qs , ** kwargs ) ) for ( col , qs ) in queries . items ( ) ) ) #NEWLINE# for other in Subscription . objects . filter ( connection = obj . connection_id , collections__collection_name__in = [ col . name for col in queries ] ) . exclude ( pk = obj . pk ) . order_by ( 'pk' ) . distinct ( ) : #NEWLINE# #INDENT# other_pub = self . get_pub_by_name ( other . publication ) #NEWLINE# for qs in other_pub . user_queries ( other . user , * other . params ) : #NEWLINE# #INDENT# ( qs , col ) = self . qs_and_collection ( qs ) #NEWLINE# if ( col not in to_send ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# to_send [ col ] = to_send [ col ] . exclude ( pk__in = col . objects_for_user ( * args , user = other . user_id , qs = qs , ** kwargs ) . values ( 'pk' ) ) #NEWLINE# #UNINDENT# #UNINDENT# for ( col , qs ) in to_send . items ( ) : #NEWLINE# #INDENT# ( yield ( col , qs . distinct ( ) ) )