fix pylint W0102 (dangerous-default-value)
This commit is contained in:
parent
906d91bcf1
commit
9fa3e5c6cf
2 changed files with 8 additions and 9 deletions
|
|
@ -89,13 +89,12 @@ def url_for(endpoint: str, external: Optional[bool] = False, **params: Any) -> s
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
def template_renderer(additional_folders: List = []) -> Jinja2Templates:
|
def template_renderer(additional_folders: List = None) -> Jinja2Templates:
|
||||||
|
|
||||||
t = Jinja2Templates(
|
folders = ["lnbits/templates", "lnbits/core/templates"]
|
||||||
loader=jinja2.FileSystemLoader(
|
if additional_folders:
|
||||||
["lnbits/templates", "lnbits/core/templates", *additional_folders]
|
folders.extend(additional_folders)
|
||||||
)
|
t = Jinja2Templates(loader=jinja2.FileSystemLoader(folders))
|
||||||
)
|
|
||||||
|
|
||||||
if settings.lnbits_ad_space_enabled:
|
if settings.lnbits_ad_space_enabled:
|
||||||
t.env.globals["AD_SPACE"] = settings.lnbits_ad_space.split(",")
|
t.env.globals["AD_SPACE"] = settings.lnbits_ad_space.split(",")
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ def insert_to_pg(query, data):
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
|
||||||
def migrate_core(file: str, exclude_tables: List[str] = []):
|
def migrate_core(file: str, exclude_tables: List[str] = None):
|
||||||
print(f"Migrating core: {file}")
|
print(f"Migrating core: {file}")
|
||||||
migrate_db(file, "public", exclude_tables)
|
migrate_db(file, "public", exclude_tables)
|
||||||
print("✅ Migrated core")
|
print("✅ Migrated core")
|
||||||
|
|
@ -115,7 +115,7 @@ def migrate_ext(file: str):
|
||||||
print(f"✅ Migrated ext: {schema}")
|
print(f"✅ Migrated ext: {schema}")
|
||||||
|
|
||||||
|
|
||||||
def migrate_db(file: str, schema: str, exclude_tables: List[str] = []):
|
def migrate_db(file: str, schema: str, exclude_tables: List[str] = None):
|
||||||
# first we check if this file exists:
|
# first we check if this file exists:
|
||||||
assert os.path.isfile(file), f"{file} does not exist!"
|
assert os.path.isfile(file), f"{file} does not exist!"
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@ def migrate_db(file: str, schema: str, exclude_tables: List[str] = []):
|
||||||
# hard coded skip for dbversions (already produced during startup)
|
# hard coded skip for dbversions (already produced during startup)
|
||||||
if tableName == "dbversions":
|
if tableName == "dbversions":
|
||||||
continue
|
continue
|
||||||
if tableName in exclude_tables:
|
if exclude_tables and tableName in exclude_tables:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
columns = sq.execute(f"PRAGMA table_info({tableName})").fetchall()
|
columns = sq.execute(f"PRAGMA table_info({tableName})").fetchall()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue