File tree Expand file tree Collapse file tree 10 files changed +127
-25
lines changed
ch12-forms/final/pypi_org/infrastructure
starter/pypi_org/infrastructure
final/pypi_org/infrastructure
starter/pypi_org/infrastructure
final/pypi_org/infrastructure
starter/pypi_org/infrastructure
final/pypi_org/infrastructure
starter/pypi_org/infrastructure Expand file tree Collapse file tree 10 files changed +127
-25
lines changed Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 1010sys .path .insert (0 , os .path .abspath (os .path .join (
1111 os .path .dirname (__file__ ), ".." , ".." )))
1212
13+ from pypi_org .bin .load_data import try_int
1314import pypi_org .data .db_session as db_session
1415from pypi_org .data .languages import ProgrammingLanguage
1516from pypi_org .data .licenses import License
@@ -339,13 +340,6 @@ def make_version_num(version_text):
339340 return major , minor , build
340341
341342
342- def try_int (text ) -> int :
343- try :
344- return int (text )
345- except :
346- return 0
347-
348-
349343def init_db ():
350344 top_folder = os .path .dirname (__file__ )
351345 rel_file = os .path .join ('..' , 'db' , 'pypi.sqlite' )
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
Original file line number Diff line number Diff line change 11import flask
2+ from werkzeug .datastructures import MultiDict
23
34
45class RequestDictionary (dict ):
@@ -13,10 +14,21 @@ def __getattr__(self, key):
1314def create (default_val = None , ** route_args ) -> RequestDictionary :
1415 request = flask .request
1516
17+ # Adding this retro actively. Some folks are experiencing issues where they
18+ # are getting a list rather than plain dict. I think it's from multiple
19+ # entries in the multidict. This should fix it.
20+ args = request .args
21+ if isinstance (request .args , MultiDict ):
22+ args = request .args .to_dict ()
23+
24+ form = request .form
25+ if isinstance (request .args , MultiDict ):
26+ form = request .form .to_dict ()
27+
1628 data = {
17- ** request . args , # The key/value pairs in the URL query string
29+ ** args , # The key/value pairs in the URL query string
1830 ** request .headers , # Header values
19- ** request . form , # The key/value pairs in the body, from a HTML post form
31+ ** form , # The key/value pairs in the body, from a HTML post form
2032 ** route_args # And additional arguments the method access, if they want them merged.
2133 }
2234
You can’t perform that action at this time.
0 commit comments