Skip to content

Commit 1651f81

Browse files
committed
Python: Refactor to avoid confusing name
After discussion with @yoff
1 parent ed2dc5f commit 1651f81

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

python/ql/src/semmle/python/frameworks/Django.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,8 +2024,15 @@ private module Django {
20242024
result = djangoRouteHandlerFunctionTracker(DataFlow::TypeTracker::end(), func)
20252025
}
20262026

2027-
/** A class that might be a django View class. */
2028-
class PossibleDjangoViewClass extends Class {
2027+
/**
2028+
* In order to recognize a class as being a django view class, based on the `as_view`
2029+
* call, we need to be able to track such calls on _any_ class. This is provided by
2030+
* the member predicates of this QL class.
2031+
*
2032+
* As such, a Python class being part of `DjangoViewClassHelper` doesn't signify that
2033+
* we model it as a django view class.
2034+
*/
2035+
class DjangoViewClassHelper extends Class {
20292036
/** Gets a reference to this class. */
20302037
private DataFlow::Node getARef(DataFlow::TypeTracker t) {
20312038
t.start() and
@@ -2061,7 +2068,7 @@ private module Django {
20612068
}
20622069

20632070
/** A class that we consider a django View class. */
2064-
abstract class DjangoViewClass extends PossibleDjangoViewClass {
2071+
abstract class DjangoViewClass extends DjangoViewClassHelper {
20652072
/** Gets a function that could handle incoming requests, if any. */
20662073
Function getARequestHandler() {
20672074
// TODO: This doesn't handle attribute assignment. Should be OK, but analysis is not as complete as with

0 commit comments

Comments
 (0)