Inherit "methods" in MethodView
* Current behavior: If a base class inherits MethodView and child class inherits without overwriting "methods". The "methods" defined in base class would be ignored * Fix: Inherit all the "methods" defined in base classes if "methods" variable is not overwritten
This commit is contained in:
parent
8ef56c8c6d
commit
1f3923a999
3 changed files with 27 additions and 3 deletions
|
|
@ -120,6 +120,10 @@ class MethodViewType(type):
|
|||
if "methods" not in d:
|
||||
methods = set()
|
||||
|
||||
for base in bases:
|
||||
if getattr(base, "methods", None):
|
||||
methods.update(base.methods)
|
||||
|
||||
for key in http_method_funcs:
|
||||
if hasattr(cls, key):
|
||||
methods.add(key.upper())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue