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
Python: Model the Pyramid framework #16300
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice progress 👍 a few comments from following along the commits 😊
} | ||
|
||
abstract class ViewCallable extends PotentialViewCallable, Http::Server::RequestHandler::Range { | ||
override Parameter getARoutedParameter() { result = this.getRequestParameter() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for a route like /hello/<name>
that is handled by def handle_hello(request, name): ...
the <name>
is a routed parameter. I haven't looked at the pyramid docs whether this is something they do, but that's sort of what it's for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think pyramid has parameters like that (instead name
would be in a matchdict
object on the request
.
Should the request
parameter be modeled as a remote flow source separately from this then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the request parameter be modeled as a remote flow source separately from this then?
Yes please 👍
private class PotentialViewCallable extends Function { | ||
PotentialViewCallable() { | ||
this.getPositionalParameterCount() = 1 and | ||
this.getArgName(0) = "request" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a hard requirement that the request parameter MUST be called request
? or could it be named req
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation suggests that it should:
View callables must, at a minimum, accept a single argument named request.
however empirical testing seems to show it can allow other names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, let's include that in our tests, and let's change our modeling to handle that 👍
ea09926
to
c6372d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍 I've seen your (internal only) discussion around whether we recognize any route setups without a request handler, and appreciate the additional tests you added 💪
Adds models for the Pyramid framework - models view callables,
Request
andResponse
objects, and http redirects