def _number_must_not_exist(number): ''' ensures name doesn't already exist in db ''' # add +1 at beginning number number = "+1" + number if number_exists(number): raise ValidationError('This phone number has already been taken.')
def receive_text(): ''' method to recieve texts, parse them, and store in mongo''' # store the text body and phone number body = request.values.get('Body') number = request.values.get('From') if number_exists(number): process.process_existing(body, number) else: process.process_new(body, number)
def _process_valid_signup(body, number): if number_exists(number): send_already_signed_up(tnumber) else: send_signup_request(number)