grok.template() is not properly inherited in subclasses

Bug #255005 reported by Jan Wijbrand Kolman
6
Affects Status Importance Assigned to Milestone
grok
Fix Released
High
Jan Wijbrand Kolman
0.14
Won't Fix
High
Jan Wijbrand Kolman
1.0
Won't Fix
High
Jan Wijbrand Kolman
1.1
Invalid
Undecided
Jan Wijbrand Kolman

Bug Description

The grok.template() directive set on a view component is not inherited by subclasses of this view. This is contrary to e.g. grok.context() and grok.name() that are properly inherited.

Consider:

in module app.py:
-----------------------

import grok

class MyApp(grok.Application, grok.Container):
    pass

class AppIndex(grok.View):
    grok.context(MyApp)
    grok.name('index')
    grok.template('index')

in module more.py:
-------------------------

import grok

import app

class AnotherAppView(app.AppIndex):
    grok.name('foo')

Will result in:

ConfigurationExecutionError: <class 'martian.error.GrokError'>: View <class '...more.AnotherAppView'> has no associated template or 'render' method.

Revision history for this message
Philipp von Weitershausen (philikon) wrote : Re: [Bug 255005] [NEW] grok.template() is not properly inherited in subclasses

When you fix this, can you please do so in grokcore.view instead of
the grok trunk? I will release grokcore.view 1.0 soon and will make
the grok trunk use it.

Thanks.

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

@Philipp - yes, I'm trying to fix this in grokcore.view indeed.

From the original description it might not be clear enough that this happens for views that subclass views *from another module*. Subclasses of views in the same module do not seem to suffer from this problem.

Revision history for this message
Jan Wijbrand Kolman (janwijbrand) wrote :
Revision history for this message
Reinout van Rees (reinout) wrote :

This ought to be easier how that View/CodeView are split.

Revision history for this message
Martijn Faassen (faassen) wrote :

We're not going to fix it in 1.0.

Revision history for this message
Marc Nieper-Wißkirchen (marc-nieper-wisskirchen) wrote :

Are there plans to fix it in 1.1.x?

Marc

Revision history for this message
Christian Klinger (cklinger) wrote :

This example works in new grok 1.2.

Changed in grok:
status: In Progress → Fix Released
status: Fix Released → Won't Fix
status: Won't Fix → Fix Released
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.