removed prints

This commit is contained in:
Hayden 2021-01-09 12:57:34 -09:00
parent f73437df4f
commit caad1acd76
4 changed files with 8 additions and 7 deletions

View File

@ -21,5 +21,4 @@ def root():
@router.get("/{full_path:path}", include_in_schema=False)
def root_plus(full_path):
print(full_path)
return FileResponse(BASE_HTML)

View File

@ -41,6 +41,7 @@ def import_migration(recipe_dict: dict) -> dict:
def import_from_archive(file_name: str) -> list:
successful_imports = []
failed_imports = []
file_path = BACKUP_DIR.joinpath(file_name)
@ -58,7 +59,8 @@ def import_from_archive(file_name: str) -> list:
recipeDoc.save()
successful_imports.append(recipe.stem)
except:
logger.error("Failed Import:", recipe.stem)
logger.info(f"Failed Import: {recipe.stem}")
failed_imports.append(recipe.stem)
image_dir = TEMP_DIR.joinpath("images")
for image in image_dir.iterdir():
@ -66,7 +68,8 @@ def import_from_archive(file_name: str) -> list:
shutil.copy(image, IMG_DIR)
shutil.rmtree(TEMP_DIR)
return successful_imports
return {"successful": successful_imports, "failed": failed_imports}
def export_db(tag=None, templates=None):
@ -91,6 +94,8 @@ def export_db(tag=None, templates=None):
export_recipes(recipe_folder, template)
elif type(templates) == str:
export_recipes(recipe_folder, templates)
else:
export_recipes(recipe_folder)
zip_path = BACKUP_DIR.joinpath(f"{export_tag}")
shutil.make_archive(zip_path, "zip", backup_folder)
@ -108,6 +113,7 @@ def export_images(dest_dir) -> Path:
def export_recipes(dest_dir: Path, template=None) -> Path:
all_recipes = RecipeDocument.objects()
logger.info(f"Backing Up Recipes: {all_recipes}")
for recipe in all_recipes:
json_recipe = recipe.to_json(indent=4)

View File

@ -46,7 +46,6 @@ def read_chowdown_file(recipe_file: Path) -> Recipe:
recipe_data: dict = {}
try:
for x, item in enumerate(yaml.load_all(stream, Loader=Loader)):
print(item)
if x == 0:
recipe_data = item
@ -54,7 +53,6 @@ def read_chowdown_file(recipe_file: Path) -> Recipe:
recipe_description = str(item)
except yaml.YAMLError as exc:
print(exc)
return
reformat_data = {
@ -89,7 +87,6 @@ def chowdown_migrate(repo):
failed_recipes = []
for recipe in recipe_dir.glob("*.md"):
print(recipe.name)
try:
new_recipe = read_chowdown_file(recipe)
new_recipe.save_to_db()

View File

@ -6,7 +6,6 @@ class SnackResponse:
if additional_data:
snackbar.update(additional_data)
print(snackbar)
return snackbar