mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
remove bar exceptions
This commit is contained in:
parent
fa14c1f24b
commit
c7256d7212
15 changed files with 23 additions and 23 deletions
|
@ -44,7 +44,7 @@ def export_database(data: BackupJob, session: Session = Depends(generate_session
|
|||
export_groups=data.options.groups,
|
||||
)
|
||||
return {"export_path": export_path}
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
|
||||
|
||||
|
@ -95,5 +95,5 @@ def delete_backup(file_name: str):
|
|||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
try:
|
||||
file_path.unlink()
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
|
|
|
@ -39,7 +39,7 @@ async def create_group(
|
|||
|
||||
try:
|
||||
db.groups.create(session, group_data.dict())
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ def update_meal_plan(
|
|||
processed_plan = MealPlanInDB(uid=plan_id, **processed_plan.dict())
|
||||
try:
|
||||
db.meals.update(session, plan_id, processed_plan.dict())
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ def delete_meal_plan(plan_id, session: Session = Depends(generate_session), curr
|
|||
|
||||
try:
|
||||
db.meals.delete(session, plan_id)
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ async def create_recipe_category(
|
|||
|
||||
try:
|
||||
return db.categories.create(session, category.dict())
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ async def update_recipe_category(
|
|||
|
||||
try:
|
||||
return db.categories.update(session, category, new_category.dict())
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
@ -66,5 +66,5 @@ async def delete_recipe_category(
|
|||
|
||||
try:
|
||||
db.categories.delete(session, category)
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
|
|
@ -97,7 +97,7 @@ def delete_recipe(
|
|||
try:
|
||||
db.recipes.delete(session, recipe_slug)
|
||||
delete_image(recipe_slug)
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
|
|
|
@ -56,5 +56,5 @@ async def delete_recipe_tag(
|
|||
|
||||
try:
|
||||
db.tags.delete(session, tag)
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
|
|
@ -43,5 +43,5 @@ def delete_theme(theme_name: str, session: Session = Depends(generate_session),
|
|||
""" Deletes theme from the database """
|
||||
try:
|
||||
db.themes.delete(session, theme_name)
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
|
|
@ -107,7 +107,7 @@ async def update_user_image(
|
|||
|
||||
try:
|
||||
[x.unlink() for x in app_dirs.USER_DIR.join(id).glob("profile_image.*")]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
dest = app_dirs.USER_DIR.joinpath(id, f"profile_image.{extension}")
|
||||
|
@ -152,5 +152,5 @@ async def delete_user(
|
|||
if current_user.id == id or current_user.admin:
|
||||
try:
|
||||
db.users.delete(session, id)
|
||||
except:
|
||||
except Exception:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST)
|
||||
|
|
|
@ -37,7 +37,7 @@ class ExportDatabase:
|
|||
|
||||
try:
|
||||
self.templates = [app_dirs.TEMPLATE_DIR.joinpath(x) for x in templates]
|
||||
except:
|
||||
except Exception:
|
||||
self.templates = False
|
||||
logger.info("No Jinja2 Templates Registered for Export")
|
||||
|
||||
|
|
|
@ -84,20 +84,20 @@ class ImportDatabase:
|
|||
try:
|
||||
del recipe_dict["_id"]
|
||||
del recipe_dict["date_added"]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
# Migration from list to Object Type Data
|
||||
try:
|
||||
if "" in recipe_dict["tags"]:
|
||||
recipe_dict["tags"] = [tag for tag in recipe_dict["tags"] if tag != ""]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
if "" in recipe_dict["categories"]:
|
||||
recipe_dict["categories"] = [cat for cat in recipe_dict["categories"] if cat != ""]
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if type(recipe_dict["extras"]) == list:
|
||||
|
|
|
@ -54,7 +54,7 @@ def rename_image(original_slug, new_slug) -> Path:
|
|||
def write_image(recipe_slug: str, file_data: bytes, extension: str) -> Path:
|
||||
try:
|
||||
delete_image(recipe_slug)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
image_dir = Path(app_dirs.IMG_DIR.joinpath(f"{recipe_slug}"))
|
||||
|
@ -100,7 +100,7 @@ def scrape_image(image_url: str, slug: str) -> Path:
|
|||
|
||||
try:
|
||||
r = requests.get(image_url, stream=True)
|
||||
except:
|
||||
except Exception:
|
||||
logger.exception("Fatal Image Request Exception")
|
||||
return None
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ def process_meals(session: Session, meal_plan_base: MealPlanIn) -> MealPlanProce
|
|||
description=recipe.description,
|
||||
)
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
|
||||
meal_data = MealOut(
|
||||
date=meal_plan_base.startDate + timedelta(days=x),
|
||||
|
|
|
@ -115,7 +115,7 @@ class Cleaner:
|
|||
for step in instructions
|
||||
if step["type"].find("HowToStep") > -1
|
||||
]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
else:
|
||||
|
|
|
@ -21,7 +21,7 @@ def basic_recipe_from_opengraph(html: str, url: str) -> dict:
|
|||
data = extruct.extract(html, base_url=base_url)
|
||||
try:
|
||||
properties = data["opengraph"][0]["properties"]
|
||||
except:
|
||||
except Exception:
|
||||
return
|
||||
|
||||
return {
|
||||
|
|
|
@ -67,7 +67,7 @@ def download_image_for_recipe(recipe: dict) -> dict:
|
|||
try:
|
||||
img_path = scrape_image(recipe.get("image"), recipe.get("slug"))
|
||||
recipe["image"] = img_path.name
|
||||
except:
|
||||
except Exception:
|
||||
recipe["image"] = "no image"
|
||||
|
||||
return recipe
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue