[Grok-dev] Re: Zope 3 error message rage... :)

Luciano Ramalho luciano at ramalho.org
Sat Jul 7 16:36:08 EDT 2007


On 7/7/07, Martijn Faassen <faassen at startifact.com> wrote:
> Which error messages are bothering you the most? Any errors in
> particular?

Here's an example, almost identical to one that Sebastian mentioned a
couple days ago:

TypeError: unsubscriptable object (see full traceback below)

The real problem is a badly spelled macro invocation. The fact that a
high level activity such as editing page templates generates such
low-level messages as this is a problem. Somewhere along the call
stack that exception should be treated for what it is, providing an
error message with more context.

Cheers,

Luciano



2007-07-07T17:31:12 ERROR SiteError http://localhost:8080/k1/@@index
Traceback (most recent call last):
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/publisher/publish.py",
line 133, in publish
    result = publication.callObject(request, obj)
  File "/home/luciano/gsoc2007/Kirbi/eggs/grok-0.9dev_r77371-py2.4.egg/grok/publication.py",
line 41, in callObject
    return super(ZopePublicationSansProxy, self).callObject(request, ob)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/app/publication/zopepublication.py",
line 161, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/publisher/publish.py",
line 108, in mapply
    return debug_call(obj, args)
   - __traceback_info__: <kirbi.app.Index object at 0x2aaab0f3ad50>
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/publisher/publish.py",
line 114, in debug_call
    return obj(*args)
  File "/home/luciano/gsoc2007/Kirbi/eggs/grok-0.9dev_r77371-py2.4.egg/grok/components.py",
line 123, in __call__
    return self._render_template()
  File "/home/luciano/gsoc2007/Kirbi/eggs/grok-0.9dev_r77371-py2.4.egg/grok/components.py",
line 133, in _render_template
    return self.template.pt_render(namespace)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/pagetemplate/pagetemplate.py",
line 117, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
   - Warning: Macro expansion failed
   - Warning: exceptions.TypeError: unsubscriptable object
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/tal/talinterpreter.py",
line 271, in __call__
    self.interpret(self.program)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/tal/talinterpreter.py",
line 346, in interpret
    handlers[opcode](self, args)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/tal/talinterpreter.py",
line 870, in do_useMacro
    macro = self.engine.evaluateMacro(macroExpr)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/tales/tales.py",
line 696, in evaluate
    return expression(self)
   - /home/luciano/gsoc2007/Kirbi/src/kirbi/app_templates/index.pt
   - Line 1, Column 0
   - Expression: <PathExpr standard:u'context/@@master/page'>
   - Names:
      {'args': (),
       'context': <kirbi.app.Kirbi object at 0x2aaab0767230>,
       'default': <object object at 0x2aaaaab172b0>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <zope.publisher.browser.BrowserRequest instance
URL=http://localhost:8080/k1/@@index>,
       'static': <grok.components.DirectoryResource object at 0x2aaab0f3acd0>,
       'template': <index template in
/home/luciano/gsoc2007/Kirbi/src/kirbi/app_templates/index.pt>,
       'usage': <zope.pagetemplate.pagetemplate.TemplateUsage object
at 0x2aaab0f3ad10>,
       'view': <kirbi.app.Index object at 0x2aaab0f3ad50>}
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/tales/expressions.py",
line 217, in __call__
    return self._eval(econtext)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/tales/expressions.py",
line 194, in _eval
    ob = self._subexprs[-1](econtext)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/tales/expressions.py",
line 124, in _eval
    ob = self._traverser(ob, element, econtext)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/app/pagetemplate/engine.py",
line 68, in __call__
    request=request)
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/traversing/adapters.py",
line 164, in traversePathElement
    return traversable.traverse(nm, further_path)
   - __traceback_info__: (<kirbi.app.Master object at 0x2aaab0f3ae90>, 'page')
  File "/home/luciano/gsoc2007/Kirbi/parts/zope3/lib/python/zope/traversing/adapters.py",
line 49, in traverse
    return subject[name]
   - __traceback_info__: (<kirbi.app.Master object at 0x2aaab0f3ae90>,
'page', [])
  File "/home/luciano/gsoc2007/Kirbi/eggs/grok-0.9dev_r77371-py2.4.egg/grok/components.py",
line 137, in __getitem__
    return self.template.macros[key]
TypeError: unsubscriptable object
127.0.0.1 - - [7/Jul/2007:17:31:12 -0200] "GET /k1/ HTTP/1.1" 500 84
"-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.12)
Gecko/20070601 Ubuntu/dapper-security Firefox/1.5.0.12"


More information about the Grok-dev mailing list