mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-12 19:30:30 +02:00
Adjusted files for isort & autopep
This commit is contained in:
committed by
github-actions[bot]
parent
e160cc5fea
commit
adb017d6ce
@@ -54,14 +54,13 @@ def get_object_or_404(
|
|||||||
query = select(*selected_columns).where(getattr(db_class, lookup_column) == id)
|
query = select(*selected_columns).where(getattr(db_class, lookup_column) == id)
|
||||||
result = await db.execute(query)
|
result = await db.execute(query)
|
||||||
row = result.first()
|
row = result.first()
|
||||||
|
|
||||||
if row is None:
|
if row is None:
|
||||||
raise HTTPException(status_code=404, detail="The object does not exist.")
|
raise HTTPException(status_code=404, detail="The object does not exist.")
|
||||||
if hasattr(row, "_mapping"):
|
if hasattr(row, "_mapping"):
|
||||||
obj_dict = dict(row._mapping)
|
obj_dict = dict(row._mapping)
|
||||||
else:
|
else:
|
||||||
obj_dict = {column.key: getattr(row, column.key)
|
obj_dict = {column.key: getattr(row, column.key) for column in selected_columns}
|
||||||
for column in selected_columns}
|
|
||||||
else:
|
else:
|
||||||
query = select(db_class).where(getattr(db_class, lookup_column) == id)
|
query = select(db_class).where(getattr(db_class, lookup_column) == id)
|
||||||
result = await db.execute(query)
|
result = await db.execute(query)
|
||||||
|
|||||||
Reference in New Issue
Block a user