-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use page 1 metadata for allowed methods #204
Comments
I like the idea - it puts control where it should be, in the page. What I don't like is More Magic Names. Can we namespace it somehow? what about putting all this stuff on something called 'self' ? (thus referring to the simplate/endpoint)
Actually seems clearer to me than without the 'self'. |
Would |
And would we call it |
We already have |
So it sounds like we would use |
A simple variable was my original idea too (liberapay/liberapay.com#116), but that wouldn't alert the developer if they type the name wrong. The simplest solution to that would be to do: +resource.allow('GET', 'POST')
[---]
-request.allow('GET', 'POST') But there's another issue: should the above disallow I guess the simplest solution to that would be to have two methods, e.g. |
It could, right? for method in allowed_methods:
if method not in ALL_METHODS:
raise Warning('Unusual verb') |
:D I meant the name of the variable, not the HTTP methods. |
🐭 |
Another question just came to me: do we want this to be in Pando, or in Aspen? I guess it would be better in Aspen because then the Django and Flask plugins could benefit from it. Note that Aspen currently doesn't have access to the method, we would need to put it in the |
Is there a way that Aspen can delegate to the framework/plugin, so that it doesn't need to know the method? (Is the |
I suppose Aspen could provide an algorithm function that isn't in its own algorithm by default but instead is meant to be inserted into it by Pando and others. That would avoid the code duplication without actually requiring that the method be passed to Aspen.
The latter doesn't exist anymore on the |
Okay, so |
Right now we have a
request.allow
method that raises 405 if the method isn't in*args
. What if we did this declaratively in page 1 rather than programmatically in page 2?That would be the default, meaning simplates would have to explicitly opt in to non-idempotent methods. That smells more secure to me, along the lines of explicitly exporting variables from page 2 into the page 3 template context (#165).
It also moves us in the direction of using metadata in page 1 to influence request handling. I like that direction, somehow.
The text was updated successfully, but these errors were encountered: