19 Mar 2023 |
Mickey | can you confirm that you can reproduce it? if not, then.. ugh :/ | 16:28:00 |
provinzkraut | Yes I can | 16:30:11 |
provinzkraut | It is indeed a bug though, and not an issue with the design | 16:30:22 |
provinzkraut | 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 |
provinzkraut | Do you care to open an issue for this, then we should be able to get a fix out soon | 16:32:02 |
Mickey | i will raise an issue yes, thank you for your pateince | 16:32:33 |
Mickey | patience, rather*. | 16:32:49 |
20 Mar 2023 |
| Arych joined the room. | 02:21:22 |
| MO joined the room. | 04:14:42 |
__peter__ | I'm having some trouble using the initial_state parameter for SQLAlchemy 2.0 | 07:15:54 |
provinzkraut | New benchmarks using our alpha1 release! | 11:16:10 |
Goldziher | Where? | 11:16:21 |
| ZimaPurple joined the room. | 12:32:58 |
| Chandler joined the room. | 14:44:37 |
| mavericsb joined the room. | 15:23:48 |
cofin | 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 |
cofin | However, since the update. It only matches one level of "/" in the URL | 17:40:45 |
cofin | I was using this to redirect everything not already defined as a route back to the main SPA index | 17:41:04 |
cofin | I'd like something very simple to configure though | 17:46:19 |
cofin | Instead of appending in all of the route combinations. Ideally, the SPA would be serving it's on 404 | 17:46:56 |
cofin | which maybe that's the right approach | 17:47:00 |
cofin | and i just copy the index.html to 404.html | 17:47:24 |
Alc | I just read this, wouldn't adding exception_handlers={NotFoundException: return_index_function} work? | 17:48:49 |
cofin | hmmm | 17:49:12 |
Alc | * 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 |
cofin | I can try this | 17:49:17 |
Alc | 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 |
Alc | * 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 |
cofin | I had to jump to a meeting, but this will be one of the first thing I try this afternoon. | 19:01:44 |
cofin | I think it's working if that's what you get though | 19:01:53 |