예제 #1
0
 def download(service_id, upload_id):
     return strip_whitespace(
         s3download(
             service_id,
             upload_id,
             bucket=ContactList.get_bucket_name(),
         ))
def validate_address(address_line, column):
    if Columns.make_key(column) in Columns.from_keys(optional_address_columns).keys():
        return address_line
    if Columns.make_key(column) not in Columns.from_keys(first_column_headings['letter']).keys():
        raise TypeError
    if not address_line or not strip_whitespace(address_line):
        raise InvalidAddressError('Missing')
    return address_line
 def __init__(
     self,
     file_data,
     template,
     max_errors_shown=20,
     max_initial_rows_shown=10,
     whitelist=None,
     remaining_messages=sys.maxsize,
     allow_international_sms=False,
     allow_international_letters=False,
 ):
     self.file_data = strip_whitespace(file_data, extra_characters=',')
     self.max_errors_shown = max_errors_shown
     self.max_initial_rows_shown = max_initial_rows_shown
     self.whitelist = whitelist
     self.template = template
     self.allow_international_sms = allow_international_sms
     self.allow_international_letters = allow_international_letters
     self.remaining_messages = remaining_messages
     self.rows_as_list = None
예제 #4
0
 def __init__(
     self,
     file_data,
     template_type=None,
     placeholders=None,
     max_errors_shown=20,
     max_initial_rows_shown=10,
     whitelist=None,
     template=None,
     remaining_messages=sys.maxsize,
     international_sms=False,
 ):
     self.file_data = strip_whitespace(file_data, extra_characters=',')
     self.template_type = template_type
     self.placeholders = placeholders
     self.max_errors_shown = max_errors_shown
     self.max_initial_rows_shown = max_initial_rows_shown
     self.whitelist = whitelist
     self.template = template if isinstance(template, Template) else None
     self.international_sms = international_sms
     self.rows = list(self.get_rows())
     self.remaining_messages = remaining_messages
예제 #5
0
def test_strip_whitespace(value):
    assert strip_whitespace(value) == 'bar'