def hooks(): hook_path = Path(app.config["USER_DIR"]) / "hooks.py" if not hook_path.exists(): with hook_path.open("w") as f: f.write( "from archivy.config import BaseHooks\n" "class Hooks(BaseHooks):\n" " # see available hooks at https://archivy.github.io/reference/hooks/\n" " def on_dataobj_create(self, dataobj): # for example\n" " pass") open_file(hook_path)
def config(): open_file(str(Path(app.config["INTERNAL_DIR"]) / "config.yml"))
def local_edit(dataobj_id): dataobj = data.get_item(dataobj_id) if dataobj: data.open_file(dataobj["fullpath"]) return Response(status=200) return Response(status=404)