Commit 68da7cd454c959e31542b64c46929a50dba7e18c
1 parent
8ec0ce68
Exists in
master
Improve robustness of input addresses reading some more.
Showing
1 changed file
with
12 additions
and
2 deletions
Show diff stats
flaskr/controllers/main_controller.py
... | ... | @@ -131,8 +131,18 @@ def gather_addresses(from_list, from_file): |
131 | 131 | else: |
132 | 132 | addresses = from_list.replace("\r", '').split("\n") |
133 | 133 | |
134 | - # Remove empty lines (if any) | |
135 | - addresses = [a for a in addresses if a] | |
134 | + clean_addresses = [] | |
135 | + for address in addresses: | |
136 | + if not address: | |
137 | + continue | |
138 | + elif type(address).__name__ == 'str': | |
139 | + clean_addresses.append(unicode(address, 'utf-8')) | |
140 | + else: | |
141 | + clean_addresses.append(address) | |
142 | + addresses = clean_addresses | |
143 | + | |
144 | + # Remove empty lines (if any) and white characters | |
145 | + addresses = [a.strip() for a in addresses if a] | |
136 | 146 | |
137 | 147 | return "\n".join(addresses) |
138 | 148 | ... | ... |