Commit 3d17c7c30f28b29722c3d4c028281c409b3dbb08
1 parent
cc2f4661
Exists in
master
chore: move to python 3 API
Spent time is not attached to this commit only. /spend 11h
Showing
3 changed files
with
9 additions
and
8 deletions
Show diff stats
flaskr/content.py
1 | 1 | from collections import namedtuple |
2 | -from yaml import safe_load as yaml_safe_load | |
3 | 2 | from os.path import abspath, dirname, join |
4 | 3 | |
4 | +from yaml import safe_load as yaml_safe_load | |
5 | + | |
6 | +# Move this to ENV, perhaps | |
7 | +base_url = "https://travel-footprint-calculator.irap.omp.eu" | |
5 | 8 | |
6 | 9 | PROJECT_DIRECTORY = abspath(dirname(dirname(__file__))) |
7 | 10 | |
... | ... | @@ -21,7 +24,7 @@ class Struct(object): |
21 | 24 | def __new__(cls, data): |
22 | 25 | if isinstance(data, dict): |
23 | 26 | return namedtuple( |
24 | - 'Struct', data.iterkeys() | |
27 | + 'Struct', data.keys() | |
25 | 28 | )( |
26 | 29 | *(Struct(val) for val in data.values()) |
27 | 30 | ) |
... | ... | @@ -33,9 +36,6 @@ class Struct(object): |
33 | 36 | |
34 | 37 | content = Struct(content_dict) |
35 | 38 | |
36 | -# Move this to ENV, perhaps | |
37 | -base_url = "https://travel-footprint-calculator.irap.omp.eu" | |
38 | - | |
39 | 39 | |
40 | 40 | # For Python3? |
41 | 41 | # def dict2obj(d): | ... | ... |
flaskr/controllers/main_controller.py
... | ... | @@ -154,8 +154,9 @@ def gather_addresses(from_list, from_file): |
154 | 154 | for address in addresses: |
155 | 155 | if not address: |
156 | 156 | continue |
157 | - if type(address).__name__ == 'str': | |
158 | - address = unicode(address, 'utf-8') | |
157 | + # if type(address).__name__ == 'str': | |
158 | + # address = str(address).encode('utf-8') | |
159 | + address = str(address) | |
159 | 160 | if to_ignore.match(address) is not None: |
160 | 161 | continue |
161 | 162 | clean_addresses.append(address) | ... | ... |
requirements.txt