def personal_information(self, user, form): form['fname'] = user.get('first_name').upper() form['mname'] = user.get('middle_name', '').upper() form['lname'] = user.get('last_name').upper() form['sex'] = parse_gender(user.get('gender')) form['email'] = user.get('email', '')
def illinois_personal_info(self, user): self.browser.open('https://ova.elections.il.gov/Step6.aspx') frm = self.browser.get_form() frm['ctl00$MainContent$tbSSN'].value = user['ssn_last4'] frm['ctl00$MainContent$rblSex'].value = parse_gender(user['gender']) self.browser.submit_form(frm, submit=frm['ctl00$MainContent$btnNext'])
def general_information(self, user, form): # these fields are all optional, fill in only if defined if user.get('gender'): form['gender'].options = [ 'Male', 'Female' ] # they have two buttons with the same name but different ids gender_str = parse_gender( user['gender']) # coerces free text to M/F if gender_str is 'F': form['gender'].value = 'Female' elif gender_str is 'M': form['gender'].value = 'Male' else: raise ValidationError(message='parse_gender error', payload=user['gender']) # poll_worker if user.get('ssn_last_4'): form['ssnId'] = user['ssn_last_4'] # also accepts full SSN, but no dashes if user.get('email'): form['emailId'] = user['email'] if user.get('phone'): form['telephone'] = user['phone'] # format? # ethnicity requires a dropdown, and is optional # skip it # previous address appears here if user.get('has_previous_address'): prev_address_components = get_address_components( user['previous_address'], user['previous_city'], user['previous_state'], user['previous_zip']) form['preStreetNo'].value = prev_address_components[ 'primary_number'] form['preStreetName'].value = get_street_name_from_components( prev_address_components).upper() if 'secondary_number' in prev_address_components: form['preAptNo'].value = prev_address_components[ 'secondary_number'] form['prePostalCity'].value = prev_address_components['city_name'] form[ 'ctl00$MainContent$TxtPrevRegZip'].value = prev_address_components[ 'zipcode'] form['preState'].value = prev_address_components[ 'state_abbreviation'] form.action = 'summary.do' self.browser.submit_form(form, submit=form['next']) return form
def edit_voter_information(self, user, form): party_options = options_dict(form['editVoterForm:partyAffiliationId']) # do fuzzy match to political party options party = get_party_from_list(user['political_party'], party_options.keys()) # it is required. if we haven't found a match, defer to 'Unaffiliated' if not party: party = 'Unaffiliated' form['editVoterForm:partyAffiliationId'].value = party_options[party] if user['military_or_overseas']: form['editVoterForm:areUOCAVAId'].value = 'Y' form['editVoterForm:uocavaTypeId'].value = 'a' if user[ 'military_or_overseas'] == 'military' else 'c' else: form['editVoterForm:areUOCAVAId'].value = 'N' form['editVoterForm:uocavaBallotMethodId'].value = 'Mail' if user[ 'vote_by_mail'] else 'Email' # or 'Fax' # email, phone and gender are prefilled form['editVoterForm:emailId'].value = user['email'] form[ 'editVoterForm:receiveEmailCommunicationId'].checked = 'checked' if user[ 'email'] else '' if 'phone' in user: # strip country prefix form['editVoterForm:phoneId'].value = user['phone'].replace( '+1', '') gender_str = parse_gender(user['gender']) if gender_str is 'F': form['editVoterForm:genderSelectId'].value = '0' elif gender_str is 'M': form['editVoterForm:genderSelectId'].value = '1' else: raise ValidationError(message='parse_gender error', payload=user['gender']) form['editVoterForm:resAddress'].value = user['address'] form['editVoterForm:resCity'].value = user['city'] form['editVoterForm:resCounty'].value = options_dict( form['editVoterForm:resCounty'])[user['county']] form['editVoterForm:resZip'].value = user['zip'] self.browser.submit_form(form, submit=form['editVoterForm:j_idt114'])
def voting_identity(self, user, form): if user.get('privacy_notice'): form['Identity.HasReadPrivacyActNotice'] = "true" else: self.add_error('You must agree to have read the privacy notice', field='privacy_notice') form['Identity.FirstName'].value = user['first_name'] if user.get('middle_name'): form['Identity.MiddleName'].value = user['middle_name'] else: form['Identity.NoMiddleName'] = "true" form['Identity.LastName'].value = user['last_name'] if user.get('suffix'): form['Identity.Suffix'].value = user['suffix'] else: form['Identity.NoSuffix'] = "true" (year, month, day) = split_date(user['date_of_birth']) form['Identity.DateOfBirth'].value = '/'.join([month, day, year]) # values need to be M/F form['Identity.Gender'].value = parse_gender(user['gender']) if user.get('ssn') == "NONE": form['Identity.DoesNotHaveSocialSecurityNumber'] = "true" else: form['Identity.SocialSecurityNumber'] = user.get('ssn') if user.get('state_id_number') and user.get('consent_use_signature'): form['Identity.DmvConsent'] = "Consent" form['Identity.DmvNumber'] = user.get('state_id_number').replace('-', '') elif not user.get('consent_use_signature'): form['Identity.DmvConsent'] = "Decline" elif not user.get('state_id_number'): form['Identity.DmvConsent'] = "DoNotHave" self.browser.submit_form(form)