def transition_of_num_of_registered(): 'the transition of number of registered users' database = database_open() database_execute( database, "SET max_error_count = 0" ) fetched = database_fetch( database, SQL_TRANSITION_USERS ) database_execute( database, "SET max_error_count = 64" ) database_close( database ) return fetched
def num_of_registered(): 'the number of registerd users' database = database_open() fetched = database_fetch( database, SQL_NUM_OF_REGISTERED ) database_close( database ) try: return fetched[ 0 ][ 'COUNT( * )' ] except: return 0
def do_it(): 'do it' try: database = database_open() day, hour = get_day(), int( sys.argv[ 1 ] ) users = get_user_by_date( database, day, hour ) if not users: database_close( database ) return utas = get_uta_by_indices( database, [ user[ 'send_index' ] for user in users ] ) smtpserver = get_smtpserver() for user in users: process_user( user, utas, database, smtpserver ) database_close( database ) smtpserver.close() except: error_handler()