grok.template doesn't complain if the given template does not exist

Bug #225855 reported by Christian Theune
4
Affects Status Importance Assigned to Milestone
grok
Fix Committed
Medium
Reinout van Rees
1.0
Won't Fix
Medium
Reinout van Rees
1.1
Fix Committed
Medium
Martijn Faassen

Bug Description

I made the following mistake (appending .pt to the template name but asdf.pt exists):

class Foo(grok.View):
    grok.template('asdf.pt')

and received the following error message:

zope.configuration.config.ConfigurationExecutionError: martian.error.GrokError: View <class 'rdbexample.app.DepartmentList'> has no associated template or 'render' method.

This should say that template 'asdf' doesn't exist.

todd (todd-infrae)
Changed in grok:
assignee: nobody → janwijbrand
milestone: none → 1.0
Changed in grok:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Reinout van Rees (reinout) wrote :

The latest grokcore.view splitted View into View and CodeView. View always needs a template, so the error message is already much clearer as it doesn't need to take a render() into account.

Instead of "no associated template or render method" you only get "has no associated template". (With the freshly released grokcore.view that's going to be in 1.0beta1).

It can be made more clear if grokcore/view/templatereg.py is modified to keep track whether there's a grok.template setting and to return that in the error message when applicable.

So: partially fixed, but needs a bit of improvement.

Revision history for this message
Reinout van Rees (reinout) wrote :

I was the last one to touch it (together with christian klinger), so I can take a stab at it.

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

I will pick up this bug again when the new template-registry stuff is merged...

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

it took a while but... we fixed the issue!

Changed in grok:
status: Confirmed → Fix Committed
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.