Skip to content

Commit 68bf1f3

Browse files
committed
Expected dictionary got response error, fixes talkpython#8
1 parent 2c196d7 commit 68bf1f3

File tree

22 files changed

+125
-30
lines changed

22 files changed

+125
-30
lines changed

app/ch05_jinja_templates/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -11,9 +13,9 @@ def response_inner(f):
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
1315

14-
if isinstance(response_val, werkzeug.wrappers.response.Response):
16+
if isinstance(response_val, werkzeug.wrappers.Response):
1517
return response_val
16-
18+
1719
if isinstance(response_val, flask.Response):
1820
return response_val
1921

app/ch06_routing/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch06_routing/starter/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch08_adding_our_design/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch08_adding_our_design/starter/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch09_sqlalchemy/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch09_sqlalchemy/starter/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch10_using_sqlachemy/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch10_using_sqlachemy/starter/pypi_org/infrastructure/view_modifiers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

app/ch11_migrations/final/pypi_org/infrastructure/view_modifiers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from functools import wraps
22

33
import flask
4+
import werkzeug
5+
import werkzeug.wrappers
46

57

68
def response(*, mimetype: str = None, template_file: str = None):
@@ -10,6 +12,10 @@ def response_inner(f):
1012
@wraps(f)
1113
def view_method(*args, **kwargs):
1214
response_val = f(*args, **kwargs)
15+
16+
if isinstance(response_val, werkzeug.wrappers.Response):
17+
return response_val
18+
1319
if isinstance(response_val, flask.Response):
1420
return response_val
1521

@@ -36,6 +42,7 @@ def view_method(*args, **kwargs):
3642

3743
return response_inner
3844

45+
3946
#
4047
# def template(template_file: str = None):
4148
# def template_inner(f):

0 commit comments

Comments
 (0)