!kMWUozpiQQIMarwfGo:matrix.org

Starlite Development

346 Members
Development of the Starlite API opensource library2 Servers

Load older messages


SenderMessageTime
19 Mar 2023
@_discord_796293869511507979:t2bot.ioMickey can you confirm that you can reproduce it? if not, then.. ugh :/ 16:28:00
@_discord_1032229898753933312:t2bot.ioprovinzkraut Yes I can 16:30:11
@_discord_1032229898753933312:t2bot.ioprovinzkraut It is indeed a bug though, and not an issue with the design 16:30:22
@_discord_1032229898753933312:t2bot.ioprovinzkraut The behaviour to discard the engine on shutdown is correct, but it should be created on startup as well, which it currently is not 16:31:38
@_discord_1032229898753933312:t2bot.ioprovinzkraut Do you care to open an issue for this, then we should be able to get a fix out soon 16:32:02
@_discord_796293869511507979:t2bot.ioMickey i will raise an issue yes, thank you for your pateince 16:32:33
@_discord_796293869511507979:t2bot.ioMickey patience, rather*. 16:32:49
20 Mar 2023
@_discord_318249771792072705:t2bot.ioArych joined the room.02:21:22
@_discord_360477372312584193:t2bot.ioMO joined the room.04:14:42
@_discord_947242363439448155:t2bot.io__peter__ I'm having some trouble using the initial_state parameter for SQLAlchemy 2.0 07:15:54
@_discord_1032229898753933312:t2bot.ioprovinzkraut New benchmarks using our alpha1 release! 11:16:10
@_discord_343092463315189762:t2bot.ioGoldziher Where? 11:16:21
@_discord_701473708442910730:t2bot.ioZimaPurple joined the room.12:32:58
@_discord_90862096178225152:t2bot.ioChandler joined the room.14:44:37
@_discord_727233470891556924:t2bot.iomavericsb joined the room.15:23:48
@_discord_396519450905673730:t2bot.iocofin I've got a controller define like so:
class WebController(Controller):
    """Web Controller."""

    opt = {"exclude_from_auth": True}

    @get(
        ["/", "/{path:str}"],
        operation_id="WebIndex",
        name="frontend:index",
        status_code=HTTP_200_OK,
        include_in_schema=False,
        opt={"exclude_from_auth": True},
    )
    async def index(self) -> Template:
        """Serve site root."""
        return Template(name="site/index.html.j2")


Before we implemented the route adjustments last week, this would match anything that wasn't already defined in another route. So: '/public/','/public/123/123' would actually match the "path" part of this
17:40:31
@_discord_396519450905673730:t2bot.iocofin However, since the update. It only matches one level of "/" in the URL 17:40:45
@_discord_396519450905673730:t2bot.iocofin I was using this to redirect everything not already defined as a route back to the main SPA index 17:41:04
@_discord_396519450905673730:t2bot.iocofin I'd like something very simple to configure though 17:46:19
@_discord_396519450905673730:t2bot.iocofin Instead of appending in all of the route combinations. Ideally, the SPA would be serving it's on 404 17:46:56
@_discord_396519450905673730:t2bot.iocofin which maybe that's the right approach 17:47:00
@_discord_396519450905673730:t2bot.iocofin and i just copy the index.html to 404.html 17:47:24
@_discord_314787529100361748:t2bot.ioAlc I just read this, wouldn't adding exception_handlers={NotFoundException: return_index_function} work? 17:48:49
@_discord_396519450905673730:t2bot.iocofin hmmm 17:49:12
@_discord_314787529100361748:t2bot.ioAlc * I just read this, wouldn't adding exception_handlers={NotFoundException: return_index_function} work? return_index_function would just redirect or render the template? 17:49:16
@_discord_396519450905673730:t2bot.iocofin I can try this 17:49:17
@_discord_314787529100361748:t2bot.ioAlc
from starlite import Starlite, NotFoundException, Request, Response
def return_index_function(request: Request, exc: NotFoundException) -> Response:
    return Response(
        content={"error": "validation error", "path": request.url.path},
        status_code=400,
    )
app = Starlite([], exception_handlers={NotFoundException: return_index_function})

404 now gives me 400, so I would say it is working?
17:51:05
@_discord_314787529100361748:t2bot.ioAlc *
from starlite import Starlite, NotFoundException, Request, Response
def return_index_function(request: Request, exc: NotFoundException) -> Response:
    return Response(
        content={"error": "validation error", "path": request.url.path},
        status_code=400,
    )
app = Starlite([], exception_handlers={NotFoundException: return_index_function})

actual 404 now gives me 400, so I would say it is working?
17:51:09
@_discord_396519450905673730:t2bot.iocofin I had to jump to a meeting, but this will be one of the first thing I try this afternoon. 19:01:44
@_discord_396519450905673730:t2bot.iocofin I think it's working if that's what you get though 19:01:53

There are no newer messages yet.


Back to Room ListRoom Version: 9