<s> from django . core . management . base import BaseCommand <EOL> import sys <EOL> from corehq . apps . domain . models import Domain <EOL> class Command ( BaseCommand ) : <EOL> def handle ( self , * args , ** options ) : <EOL> if len ( args ) != <NUM_LIT:1> : <EOL> print '<STR_LIT>' <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> report_type = args [ <NUM_LIT:0> ] <EOL> if raw_input ( <EOL> '<STR_LIT>' . format ( report_type ) ) . lower ( ) == '<STR_LIT:y>' : <EOL> for domain in Domain . get_all ( ) : <EOL> save_domain = False <EOL> for report_config in domain . dynamic_reports : <EOL> old_report_count = len ( report_config . reports ) <EOL> report_config . reports = [ r for r in report_config . reports if r . report != report_type ] <EOL> if len ( report_config . reports ) != old_report_count : <EOL> save_domain = True <EOL> if save_domain : <EOL> print '<STR_LIT>' . format ( domain . name ) <EOL> domain . save ( ) <EOL> else : <EOL> print '<STR_LIT>' </s>
