Skip to content

Commit

Permalink
Add prefix parameter to fps-contents
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Sep 6, 2023
1 parent 31026bd commit a505459
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions jupyverse_api/jupyverse_api/contents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def unwatch(self, path: str, watcher):


class Contents(Router, ABC):
def __init__(self, app: App, auth: Auth):
def __init__(self, app: App, auth: Auth, prefix: str = ""):
super().__init__(app=app)

router = APIRouter()
Expand Down Expand Up @@ -104,7 +104,7 @@ async def rename_content(
) -> Content:
return await self.rename_content(path, request, user)

self.include_router(router)
self.include_router(router, prefix=prefix)

@property
@abstractmethod
Expand Down
9 changes: 8 additions & 1 deletion plugins/contents/fps_contents/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@


class ContentsComponent(Component):
def __init__(
self,
prefix: str = "",
) -> None:
super().__init__()
self.prefix = prefix

async def start(
self,
ctx: Context,
) -> None:
app = await ctx.request_resource(App)
auth = await ctx.request_resource(Auth) # type: ignore

contents = _Contents(app, auth)
contents = _Contents(app, auth, self.prefix)
ctx.add_resource(contents, types=Contents)

0 comments on commit a505459

Please sign in to comment.