martian CLASS_OR_MODULE scope directive information is not inherited between modules

Bug #309741 reported by Jan Wijbrand Kolman
2
Affects Status Importance Assigned to Milestone
grok
Status tracked in 1.3
Nominated for 1.0 by Gerry C.
1.3
Fix Released
High
Jan Wijbrand Kolman

Bug Description

Consider a module a.py:

  import grok

  grok.context(SomeContext)

  class AContextView(grok.View):
    pass

and module b.py:

  import grok
  import a

  class BContextView(a.AContextView):
    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.

Revision history for this message
Jan Wijbrand Kolman (janwijbrand) wrote :

Fixing this bug will help fixing https://bugs.launchpad.net/grok/+bug/255005

Changed in grok:
assignee: nobody → janwijbrand
importance: Undecided → High
milestone: none → 1.0
status: New → Confirmed
Revision history for this message
Jan Wijbrand Kolman (janwijbrand) wrote :

This has been fixed in the martian refactoring for a while now already, the issue was never updated. Closed now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.