Loading resources/management/commands/fusefs.py +9 −9 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ def _db_obj_from_path(path: str, ttl_hash=None): class Ops(Operations): def __init__(self, project: Project): self.project = project def __init__(self, root_collection: Collection): self.root_collection = root_collection def _obj_from_path(self, path: str): """ Loading @@ -47,7 +47,7 @@ class Ops(Operations): """ obj = _db_obj_from_path(path, ttl_hash=get_ttl_hash()) if not obj: return self.project.root_collection return self.root_collection else: return obj Loading Loading @@ -231,14 +231,14 @@ class Ops(Operations): class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument("mount_point", type=str) parser.add_argument("project_id", type=int) parser.add_argument("root_collection", type=int) def handle(self, *args, **options): mount_point = options.get("mount_point") if not os.path.isdir(mount_point): raise CommandError(f"{mount_point} is not a directory") project_id = options.get("project_id") project = Project.objects.filter(pk=project_id).first() if not project: raise CommandError(f"{project_id} is not a valid project id") FUSE(Ops(project), mount_point, nothreads=True, foreground=True) root_collection_id = options.get("root_collection") root_collection = Collection.objects.filter(pk=root_collection_id).first() if not root_collection: raise CommandError(f"{root_collection_id} is not a valid collection id") FUSE(Ops(root_collection), mount_point, nothreads=True, foreground=True) Loading
resources/management/commands/fusefs.py +9 −9 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ def _db_obj_from_path(path: str, ttl_hash=None): class Ops(Operations): def __init__(self, project: Project): self.project = project def __init__(self, root_collection: Collection): self.root_collection = root_collection def _obj_from_path(self, path: str): """ Loading @@ -47,7 +47,7 @@ class Ops(Operations): """ obj = _db_obj_from_path(path, ttl_hash=get_ttl_hash()) if not obj: return self.project.root_collection return self.root_collection else: return obj Loading Loading @@ -231,14 +231,14 @@ class Ops(Operations): class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument("mount_point", type=str) parser.add_argument("project_id", type=int) parser.add_argument("root_collection", type=int) def handle(self, *args, **options): mount_point = options.get("mount_point") if not os.path.isdir(mount_point): raise CommandError(f"{mount_point} is not a directory") project_id = options.get("project_id") project = Project.objects.filter(pk=project_id).first() if not project: raise CommandError(f"{project_id} is not a valid project id") FUSE(Ops(project), mount_point, nothreads=True, foreground=True) root_collection_id = options.get("root_collection") root_collection = Collection.objects.filter(pk=root_collection_id).first() if not root_collection: raise CommandError(f"{root_collection_id} is not a valid collection id") FUSE(Ops(root_collection), mount_point, nothreads=True, foreground=True)