kopia lustrzana https://github.com/bugout-dev/moonstream
Add converting from json types.
rodzic
48ad43cd9b
commit
e34f544099
|
@ -188,7 +188,7 @@ async def queries_data_update_handler(
|
|||
|
||||
# request.params validations
|
||||
passed_params = {
|
||||
key: value
|
||||
key: queries.from_json_types(value)
|
||||
for key, value in request_data.params.items()
|
||||
if key in expected_query_parameters
|
||||
}
|
||||
|
|
|
@ -63,6 +63,15 @@ def to_json_types(value):
|
|||
else:
|
||||
return str(value)
|
||||
|
||||
def from_json_types(value):
|
||||
|
||||
if isinstance(value, (str, int, tuple, dict)):
|
||||
return value
|
||||
elif isinstance(value, list): # psycopg2 issue with list support
|
||||
return tuple(value)
|
||||
else:
|
||||
return str(value)
|
||||
|
||||
|
||||
def data_generate(
|
||||
bucket: str,
|
||||
|
|
Ładowanie…
Reference in New Issue