martian CLASS_OR_MODULE scope directive information is not inherited between modules
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
grok | Status tracked in 1.3 | |||||
1.3 |
Fix Released
|
High
|
Jan Wijbrand Kolman |
Bug Description
Consider a module a.py:
import grok
grok.
class AContextView(
pass
and module b.py:
import grok
import a
class BContextView(
pass
It is expected that since BContextView subclasses AContextView, the context for the BContextView class is SomeContext too (the grok.context directive has a CLASS_OR_MODULE scope).
That is currently not how the CLASS_OR_MODULE scope is implemented. Currently it will look for a context in the b.py module in the case where no grok.context directive is used on the class level - and in this example it means no context can be found for BContextView.
The solution for CLASS_OR_MODULE scope directives, in case the directive cannot be found on the component or the component's module, would be to recursively loop through the __mro__ of the component class and apply the directive.
Fixing this bug will help fixing https:/ /bugs.launchpad .net/grok/ +bug/255005