Commit f0903e168bec0bbb6f95536f7fa27bcaa48c4265
1 parent
6e04d5e5
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 | from collections import namedtuple | 1 | from collections import namedtuple |
2 | -from yaml import safe_load as yaml_safe_load | ||
3 | from os.path import abspath, dirname, join | 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 | PROJECT_DIRECTORY = abspath(dirname(dirname(__file__))) | 9 | PROJECT_DIRECTORY = abspath(dirname(dirname(__file__))) |
7 | 10 | ||
@@ -21,7 +24,7 @@ class Struct(object): | @@ -21,7 +24,7 @@ class Struct(object): | ||
21 | def __new__(cls, data): | 24 | def __new__(cls, data): |
22 | if isinstance(data, dict): | 25 | if isinstance(data, dict): |
23 | return namedtuple( | 26 | return namedtuple( |
24 | - 'Struct', data.iterkeys() | 27 | + 'Struct', data.keys() |
25 | )( | 28 | )( |
26 | *(Struct(val) for val in data.values()) | 29 | *(Struct(val) for val in data.values()) |
27 | ) | 30 | ) |
@@ -33,9 +36,6 @@ class Struct(object): | @@ -33,9 +36,6 @@ class Struct(object): | ||
33 | 36 | ||
34 | content = Struct(content_dict) | 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 | # For Python3? | 40 | # For Python3? |
41 | # def dict2obj(d): | 41 | # def dict2obj(d): |
flaskr/controllers/main_controller.py
@@ -154,8 +154,9 @@ def gather_addresses(from_list, from_file): | @@ -154,8 +154,9 @@ def gather_addresses(from_list, from_file): | ||
154 | for address in addresses: | 154 | for address in addresses: |
155 | if not address: | 155 | if not address: |
156 | continue | 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 | if to_ignore.match(address) is not None: | 160 | if to_ignore.match(address) is not None: |
160 | continue | 161 | continue |
161 | clean_addresses.append(address) | 162 | clean_addresses.append(address) |
requirements.txt
@@ -10,7 +10,7 @@ Flask-DebugToolbar==0.10.0 | @@ -10,7 +10,7 @@ Flask-DebugToolbar==0.10.0 | ||
10 | Flask-Login==0.4.0 | 10 | Flask-Login==0.4.0 |
11 | Flask-Mail==0.9.1 | 11 | Flask-Mail==0.9.1 |
12 | Flask-Script==2.0.5 | 12 | Flask-Script==2.0.5 |
13 | -Flask-SQLAlchemy==2.1 | 13 | +Flask-SQLAlchemy==2.5.1 |
14 | Flask-WTF==0.14 | 14 | Flask-WTF==0.14 |
15 | Flask-Sessionstore==0.4.5 | 15 | Flask-Sessionstore==0.4.5 |
16 | Flask-Session-Captcha==1.2.0 | 16 | Flask-Session-Captcha==1.2.0 |