From 65de503d93b61b7131966e99ff474c7dd6d174f6 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 10 May 2014 16:45:21 -0400 Subject: Populate now adds keys (with empty values) for empty input (easier to handle in modules) --- client/modules/HN.py | 2 +- client/populate.py | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/client/modules/HN.py b/client/modules/HN.py index 16aeab8..692abea 100644 --- a/client/modules/HN.py +++ b/client/modules/HN.py @@ -108,7 +108,7 @@ def handle(text, mic, profile): else: mic.say("OK I will not send any articles") - if profile['phone_number']: + if not profile['prefers_email'] and profile['phone_number']: mic.say("Here are some front-page articles. " + all_titles + ". Would you like me to send you these? If so, which?") handleResponse(mic.activeListen()) diff --git a/client/populate.py b/client/populate.py index 8ef15a9..48b8670 100644 --- a/client/populate.py +++ b/client/populate.py @@ -30,23 +30,21 @@ def run(): clean_number = lambda s: re.sub(r'[^0-9]', '', s) phone_number = clean_number(raw_input( "\nPhone number (no country code). Any dashes or spaces will be removed for you: ")) - if phone_number: - profile['phone_number'] = phone_number + profile['phone_number'] = phone_number # carrier print("\nPhone carrier (for sending text notifications).") print( "If you have a US phone number, you can enter one of the following: 'AT&T', 'Verizon', 'T-Mobile' (without the quotes). If your carrier isn't listed or you have an international number, go to http://www.emailtextmessages.com and enter the email suffix for your carrier (e.g., for Virgin Mobile, enter 'vmobl.com'; for T-Mobile Germany, enter 't-d1-sms.de').") carrier = raw_input('Carrier: ') - if carrier: - if carrier == 'AT&T': - profile['carrier'] = 'txt.att.net' - elif carrier == 'Verizon': - profile['carrier'] = 'vtext.com' - elif carrier == 'T-Mobile': - profile['carrier'] = 'tmomail.net' - else: - profile['carrier'] = carrier + if carrier == 'AT&T': + profile['carrier'] = 'txt.att.net' + elif carrier == 'Verizon': + profile['carrier'] = 'vtext.com' + elif carrier == 'T-Mobile': + profile['carrier'] = 'tmomail.net' + else: + profile['carrier'] = carrier # location def verifyLocation(place): -- cgit v1.3.1