fix pylint C0206 (consider-using-dict-items)

This commit is contained in:
Pavol Rusnak 2023-01-21 12:15:18 +00:00
parent 3e42adc66f
commit 967ce06ca5
No known key found for this signature in database
GPG key ID: 91F3B339B9A02A3D
2 changed files with 9 additions and 7 deletions

View file

@ -83,8 +83,8 @@ def url_for_vendored(abspath: str) -> str:
def url_for(endpoint: str, external: Optional[bool] = False, **params: Any) -> str: def url_for(endpoint: str, external: Optional[bool] = False, **params: Any) -> str:
base = g().base_url if external else "" base = g().base_url if external else ""
url_params = "?" url_params = "?"
for key in params: for key, value in params.items():
url_params += f"{key}={params[key]}&" url_params += f"{key}={value}&"
url = f"{base}{endpoint}{url_params}" url = f"{base}{endpoint}{url_params}"
return url return url

View file

@ -50,11 +50,13 @@ def check_db_versions(sqdb):
postgres.execute("SELECT * FROM public.dbversions;") postgres.execute("SELECT * FROM public.dbversions;")
dbpost = dict(postgres.fetchall()) dbpost = dict(postgres.fetchall())
for key in dblite.keys(): for key, value in dblite.items():
if key in dblite and key in dbpost and dblite[key] != dbpost[key]: if key in dblite and key in dbpost:
raise Exception( version = dbpost[key]
f"sqlite database version ({dblite[key]}) of {key} doesn't match postgres database version {dbpost[key]}" if value != version:
) raise Exception(
f"sqlite database version ({value}) of {key} doesn't match postgres database version {version}"
)
connection = postgres.connection connection = postgres.connection
postgres.close() postgres.close()