#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# do_execute = options . get ( 'execute' ) #NEWLINE# if do_execute : #NEWLINE# #INDENT# action = 'tagged' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# action = 'should be tagged' #NEWLINE# #UNINDENT# modified_count = 0 #NEWLINE# total = len ( Recording . objects . all ( ) ) #NEWLINE# tag = recording_tags . ACLU_NJ #NEWLINE# for recording in Recording . objects . all ( ) : #NEWLINE# #INDENT# if ( '_aclunj' in str ( recording . rec_file ) ) : #NEWLINE# #INDENT# do_save = False #NEWLINE# if do_execute : #NEWLINE# #INDENT# if ( tag not in recording . tags ) : #NEWLINE# #INDENT# self . write ( ( 'Recording %d (%s) %s with %s \n' % ( recording . pk , recording . name , action , tag ) ) ) #NEWLINE# recording . add_tag ( tag ) #NEWLINE# do_save = True #NEWLINE# modified_count += 1 #NEWLINE# try : #NEWLINE# #INDENT# potential_email = recording . private_description . rsplit ( '[' , 1 ) [ 1 ] . rsplit ( ']' , 1 ) [ 0 ] #NEWLINE# if validate_email ( potential_email ) : #NEWLINE# #INDENT# recording . email = potential_email #NEWLINE# #UNINDENT# recording . private_description = recording . private_description . rsplit ( '[' , 1 ) [ 0 ] #NEWLINE# do_save = True #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if do_save : #NEWLINE# #INDENT# recording . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag not in recording . tags ) : #NEWLINE# #INDENT# modified_count += 1 #NEWLINE# self . write ( ( 'Recording %d (%s) %s with %s \n' % ( recording . pk , recording . name , action , tag ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . write ( ( '%d/%d Recordings %s \n' % ( modified_count , total , action ) ) )