#NEWLINE# def handle( self , index , * args , **options ) : #NEWLINE# #INDENT# cleanup = options [ 'cleanup' ] #NEWLINE# noinput = options [ 'noinput' ] #NEWLINE# reindex_fns = { #NEWLINE# #INDENT# 'domain' : get_domain_reindexer , #NEWLINE# 'user' : get_user_reindexer , #NEWLINE# 'group' : get_group_reindexer , #NEWLINE# 'groups-to-user' : get_groups_to_user_reindexer , #NEWLINE# 'case' : get_couch_case_reindexer , #NEWLINE# 'form' : get_couch_form_reindexer , #NEWLINE# 'sql-case' : get_sql_case_reindexer , #NEWLINE# 'sql-form' : get_sql_form_reindexer , #NEWLINE# 'case-search' : get_case_search_reindexer , #NEWLINE# #UNINDENT# } #NEWLINE# if ( index not in reindex_fns ) : #NEWLINE# #INDENT# raise CommandError ( 'Supported indices to reindex are: {}' . format ( ',' . join ( reindex_fns . keys ( ) ) ) ) #NEWLINE# #UNINDENT# def confirm( ) : #NEWLINE# #INDENT# return ( raw_input ( 'Are you sure you want to delete the current index (if it exists)? y/n\n' ) == 'y' ) #NEWLINE# #UNINDENT# reindexer = reindex_fns [ index ] ( ) #NEWLINE# if ( cleanup and ( noinput or confirm ( ) ) ) : #NEWLINE# #INDENT# reindexer . clean_index ( ) #NEWLINE# #UNINDENT# reindexer . reindex ( )