#NEWLINE# def create_exclusions( days , occurrences , verbose , queues ) : #NEWLINE# #INDENT# days = days . split ( ',' ) #NEWLINE# for day in days : #NEWLINE# #INDENT# day_name = day #NEWLINE# day = day_names [ day ] #NEWLINE# workdate = date . today ( ) #NEWLINE# i = 0 #NEWLINE# while ( i < occurrences ) : #NEWLINE# #INDENT# if ( day == workdate . weekday ( ) ) : #NEWLINE# #INDENT# if ( EscalationExclusion . objects . filter ( date = workdate ) . count ( ) == 0 ) : #NEWLINE# #INDENT# esc = EscalationExclusion ( name = ( 'Auto Exclusion for %s' % day_name ) , date = workdate ) #NEWLINE# esc . save ( ) #NEWLINE# if verbose : #NEWLINE# #INDENT# print ( ( 'Created exclusion for %s %s' % ( day_name , workdate ) ) ) #NEWLINE# #UNINDENT# for q in queues : #NEWLINE# #INDENT# esc . queues . add ( q ) #NEWLINE# if verbose : #NEWLINE# #INDENT# print ( ( '  - for queue %s' % q ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# i += 1 #NEWLINE# #UNINDENT# workdate += timedelta ( days = 1 )