Skip to content

Commit a3d57dd

Browse files
authored
Merge pull request #246 from TradeInsight-Info/master
fix broken async controller register
2 parents 164ccb0 + 0e6a147 commit a3d57dd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ninja_extra/operation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ async def _prep_run( # type:ignore
326326
ROUTE_CONTEXT_VAR.set(None)
327327

328328
async def run(self, request: HttpRequest, **kw: Any) -> HttpResponseBase: # type: ignore
329+
from asgiref.sync import sync_to_async
329330
try:
330331
async with self._prep_run(
331332
request,
@@ -343,7 +344,7 @@ async def run(self, request: HttpRequest, **kw: Any) -> HttpResponseBase: # typ
343344
await route_function.async_run_check_permissions(ctx) # type: ignore[attr-defined]
344345

345346
if not ctx.has_computed_route_parameters:
346-
ctx.compute_route_parameters()
347+
await sync_to_async(ctx.compute_route_parameters)()
347348

348349
result = await self.view_func(request, **ctx.kwargs["view_func_kwargs"])
349350
assert ctx.response is not None

0 commit comments

Comments
 (0)