Provde a better error message on missing template directory

Bug #680528 reported by Giampaolo Rodolà on 2010-11-23
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

=== Steps to reproduce the problem ===

In a working grok application add the following line at the top of application main module:


=== Result ===

The error message printed when the server is restarted is the one pasted below.
"View <class ''> has no associated template or 'render' method." doesn't really say something about what actually happened (missing directory).

 from zope.testing import doctest, cleanup
Traceback (most recent call last):
  File "./bin/paster", line 20, in <module>
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteScript-1.7.3-py2.5.egg/paste/script/", line 84, in run
    invoke(command, command_name, options, args[1:])
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteScript-1.7.3-py2.5.egg/paste/script/", line 123, in invoke
    exit_code =
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteScript-1.7.3-py2.5.egg/paste/script/", line 218, in run
    result = self.command()
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteScript-1.7.3-py2.5.egg/paste/script/", line 276, in command
    relative_to=base, global_conf=vars)
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteScript-1.7.3-py2.5.egg/paste/script/", line 313, in loadapp
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteDeploy-1.3.4-py2.5.egg/paste/deploy/", line 203, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteDeploy-1.3.4-py2.5.egg/paste/deploy/", line 224, in loadobj
    return context.create()
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteDeploy-1.3.4-py2.5.egg/paste/deploy/", line 617, in create
    return self.object_type.invoke(self)
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteDeploy-1.3.4-py2.5.egg/paste/deploy/", line 163, in invoke
    app = context.app_context.create()
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteDeploy-1.3.4-py2.5.egg/paste/deploy/", line 617, in create
    return self.object_type.invoke(self)
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteDeploy-1.3.4-py2.5.egg/paste/deploy/", line 109, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/home/giampaolo/svn/jelle/bgb/eggs/PasteDeploy-1.3.4-py2.5.egg/paste/deploy/util/", line 57, in fix_call
    val = callable(*args, **kw)
  File "/home/giampaolo/svn/jelle/bgb/eggs/grokcore.startup-1.1-py2.5.egg/grokcore/startup/", line 19, in debug_application_factory
    app = application_factory(global_conf, **local_conf)
  File "/home/giampaolo/svn/jelle/bgb/eggs/grokcore.startup-1.1-py2.5.egg/grokcore/startup/", line 14, in application_factory
  File "/home/giampaolo/svn/jelle/bgb/eggs/", line 162, in getWSGIApplication
    db = config(configfile, schemafile, features)
  File "/home/giampaolo/svn/jelle/bgb/eggs/", line 150, in config
    appsetup.config(options.site_definition, features=features)
  File "/home/giampaolo/svn/jelle/bgb/eggs/", line 111, in config
    context = xmlconfig.file(file, context=context, execute=execute)
  File "/home/giampaolo/svn/jelle/bgb/eggs/zope.configuration-3.7.2-py2.5.egg/zope/configuration/", line 653, in file
  File "/home/giampaolo/svn/jelle/bgb/eggs/zope.configuration-3.7.2-py2.5.egg/zope/configuration/", line 606, in execute_actions
    callable(*args, **kw)
  File "/home/giampaolo/svn/jelle/bgb/eggs/grokcore.view-1.13.5-py2.5.egg/grokcore/view/meta/", line 90, in checkTemplates
    has_render, has_no_render)
  File "/home/giampaolo/svn/jelle/bgb/eggs/grokcore.view-1.13.5-py2.5.egg/grokcore/view/", line 161, in checkTemplates
    (component_name.title(), factory), factory)
zope.configuration.config.ConfigurationExecutionError: <class 'martian.error.GrokError'>: View <class ''> has no associated template or 'render' method.
  File "/home/giampaolo/svn/jelle/bgb/src/bgb/configure.zcml", line 5.2-5.27
    <grok:grok package="." />

Tags: doc Edit Tag help
Christian Klinger (cklinger) wrote :


there is a branch for grokcore.view which has a different implementation of the TemplateRegistry stuff. I suggest we wait for the merge
and after this we will look into being more verbose with missing directories.


Giampaolo Rodolà (g-rodola) wrote :

Also, it would be good if exception gets raised *when grok.templatedir("i-do-not-exist") is called* and not later (as it happens right now).
This way the traceback message will include the actual instruction wich caused the error at the top of the stack.

it took a while, but it is fixed now.

Changed in grok:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers