Open dave42w opened 4 weeks ago
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
robyn | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Nov 24, 2024 9:06pm |
Comparing dave42w:url_for
(d0d8e7b) with main
(abb42d0)
β
146
untouched benchmarks
Hey @dave42w π
Is it up for review??
Hey @dave42w π
Is it up for review??
Hesitant yes. I only commit when it passes all the tests and works to a completed step.
a) by mistake I committed local changes to pyproject.toml that are needed for using uv in my python 3.12.7 environment. I'm wondering if I need to chuck this PR, create a new branch and recommit my changes without pyproject.toml?
b) this works and the tests pass but it doesn't yet support keyword parameters (eg from the examples /crime/:crime_id). I'm working on that (got distracted by drinking wine to hide from a certain set of election results). I've worked out how to do it and it's not a big job so should be done by the end of Saturday. Did you see my discord question about whether there are any restrictions on parameters to url's? It shouldn't affect this code apart from more robust error checking see https://discord.com/channels/999782964143603713/999782965460603056/1303425727227756595
c) I would appreciate feedback on what to return for error conditions (eg no call to set_robyn, no route found) I'm trying to balance informative with not leaking info useful to someone trying to penetrate the system. In many ways I'd like to use a standard httpStatus but not sure how that would work and if it would make debugging very hard (if we had a standard static 404 url I could return that).
d) I would appreciate feedback on the issue of static files see https://github.com/sparckles/Robyn/issues/1005 I have changed the function name that goes into the template in line with that thinking (it makes it much simpler IMHO to have separate functions to use in the template for static files and for functions rather than using a "static" argument to url_for as flask does).
So short answer, feedback would be great :-)
Hi @sansyrox
I've just added the support for URL parameters. All committed with tests.
So from my previous comment today b) is done. Feedback on a) c) and d) appreciated.
Thanks
Dave
Hi @sansyrox
I've sorted out the pyproject.toml problem (a) :-)
Hey @dave42w π
Is it up for review??
Hi,
Wondering if you are able to do that review or if there is more I need to do.
Thanks
Hey @dave42w π
Apologies for the super late review. My work has been mental. I will try to complete my review by tonight or tomorrow for sure π
@sansyrox I haven't marked the 2 conversations as resolved as I figured you need to be happy with my responses first. Is that the right approach?
Hi @sansyrox I think this is ready, just need to confirm that you are happy with my responses.
Hi @sansyrox I wanted to check if you are happy for the conversations to be marked as resolved?
Hi, @sansyrox
I think the test failures are CI timeouts, this has passed all the tests at some point since the last change.
Can we merge?
Description
This PR starts the process of implementing url_for so that Jinja templates can reference Robyn endpoints by function name rather than path see https://github.com/sparckles/Robyn/issues/996
Summary
[Updated]
This PR adds a url_for that returns a fixed string and a test for this.3rd Nov 24 Now looks up functions via the Robyn object router 7th Nov. All finished.Changes are limited to 7 files (5 of them related to testing)
add_function_to_globals()
)sync_auth
function/sync_auth
in an href)TODO handle positional and named argumentsTODO add set_robyn and url_for to template_interfaceTODO warn if no Robyn object set using set_robynTODO improve response to an invalid routeTODO rename from url_for to get_function_url in preparation for adding get_static_urlTODO remove@pytest.mark.url_for
from test_get_requests.py`jinja_template = JinjaTemplate(".", "utf-8")#solves my git locale pre-commit issueTODO add unit testsTODO add unit tests that cover combinations of url'sTODO documentationPR Checklist
Please ensure that:
Pre-Commit Instructions: