Skip to content

Commit c6372d5

Browse files
Fix qldoc and remove PotentialViewCallable class
1 parent 4f22b91 commit c6372d5

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

python/ql/lib/semmle/python/frameworks/Pyramid.qll

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@ private import semmle.python.frameworks.Stdlib
2121
module Pyramid {
2222
/** Provides models for pyramid View callables. */
2323
module View {
24+
/** A dataflow node that sets up a route on a server using the Pyramid framework. */
25+
abstract private class PyramidRouteSetup extends Http::Server::RouteSetup::Range {
26+
override string getFramework() { result = "Pyramid" }
27+
}
28+
2429
/**
25-
* A callable that could be used as a pyramid view callable.
30+
* A Pyramid view callable, that handles incoming requests.
2631
*/
27-
private class PotentialViewCallable extends Function {
28-
PotentialViewCallable() { this.getPositionalParameterCount() in [1, 2] }
32+
class ViewCallable extends Function {
33+
ViewCallable() { this = any(PyramidRouteSetup rs).getARequestHandler() }
2934

30-
/** Gets the `request` parameter of this view callable. */
35+
/** Gets the `request` parameter of this callable. */
3136
Parameter getRequestParameter() {
3237
this.getPositionalParameterCount() = 1 and
3338
result = this.getArg(0)
@@ -37,18 +42,6 @@ module Pyramid {
3742
}
3843
}
3944

40-
/** A dataflow node that sets up a route on a server using the Pyramid framework. */
41-
abstract private class PyramidRouteSetup extends Http::Server::RouteSetup::Range {
42-
override string getFramework() { result = "Pyramid" }
43-
}
44-
45-
/**
46-
* A Pyramid view callable, that handles incoming requests.
47-
*/
48-
class ViewCallable extends PotentialViewCallable {
49-
ViewCallable() { this = any(PyramidRouteSetup rs).getARequestHandler() }
50-
}
51-
5245
/** A pyramid route setup using the `pyramid.view.view_config` decorator. */
5346
private class DecoratorSetup extends PyramidRouteSetup {
5447
DecoratorSetup() {
@@ -92,15 +85,16 @@ module Pyramid {
9285
/** Gets a reference to an instance of `pyramid.config.Configurator`. */
9386
DataFlow::Node instance() { instance(DataFlow::TypeTracker::end()).flowsTo(result) }
9487

95-
/** Gets a call to the `add_view` method of an instance of `pyramid.config.Configurator`. */
88+
/** A call to the `add_view` method of an instance of `pyramid.config.Configurator`. */
9689
class AddViewCall extends DataFlow::MethodCallNode {
9790
AddViewCall() { this.calls(instance(), "add_view") }
9891

92+
/** Gets the `view` argument of this call. */
9993
DataFlow::Node getViewArg() { result = [this.getArg(0), this.getArgByName("view")] }
10094
}
10195
}
10296

103-
/** Provides modelling for pyramid requests. */
97+
/** Provides modeling for pyramid requests. */
10498
module Request {
10599
/**
106100
* A source of instances of `pyramid.request.Request`, extend this class to model new instances.
@@ -167,7 +161,7 @@ module Pyramid {
167161
}
168162
}
169163

170-
/** Provides modelling for pyramid responses. */
164+
/** Provides modeling for pyramid responses. */
171165
module Response {
172166
/** A response returned by a view callable. */
173167
private class PyramidReturnResponse extends Http::Server::HttpResponse::Range {
@@ -287,7 +281,7 @@ module Pyramid {
287281
])
288282
}
289283

290-
/** Gets a call to a pyramid HTTP exception class that represents an HTTP redirect response. */
284+
/** A call to a pyramid HTTP exception class that represents an HTTP redirect response. */
291285
class PyramidRedirect extends Http::Server::HttpRedirectResponse::Range, DataFlow::CallCfgNode {
292286
PyramidRedirect() { this = classRef().getACall() }
293287

0 commit comments

Comments
 (0)