Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Use of exists: with erroneous code shows incorrect error in page template #129

davidjb opened this Issue · 0 comments

1 participant


By including this:

    <tal:block condition="exists:form">

in a page template, it appears that any error that occurs on the page, such as by including this problematic snippet:


produces an incorrect traceback:

File "/home/david/.buildout/eggs/Chameleon-2.10-py2.7.egg/chameleon/", line 125, in __call__
    return self.render(**kwargs)
  File "/home/david/.buildout/eggs/Chameleon-2.10-py2.7.egg/chameleon/zpt/", line 257, in render
    return super(PageTemplate, self).render(**vars)
  File "/home/david/.buildout/eggs/Chameleon-2.10-py2.7.egg/chameleon/", line 190, in render
    raise_with_traceback(exc, tb)
  File "/home/david/.buildout/eggs/Chameleon-2.10-py2.7.egg/chameleon/", line 172, in render
    self._render(stream, econtext, rcontext)
  File "/tmp/tmpla4Pzm/", line 2656, in render
    __macro.include(__stream, econtext.copy(), rcontext, __i18n_domain)
  File "/home/david/.buildout/eggs/Chameleon-2.10-py2.7.egg/chameleon/zpt/", line 261, in include
    self._render(*args, **kwargs)
  File "/tmp/tmpNoXbaT/", line 726, in render
    __slot_content(__stream, econtext.copy(), rcontext)
  File "/tmp/tmpla4Pzm/", line 641, in __fill_content
    __content_140487793025840 = _lookup_attr('', 'join')([1, 2, 3, ])
TypeError: form

 - Expression: "
 - Filename:   ... files/src/templates/
 - Location:   (45:18)
 - Source:     </tal:block>
 - Expression: "form"
 - Filename:   ... files/src/templates/
 - Location:   (43:35)
 - Source:     <tal:block condition="exists:form">

Previously the Expression was incorrect too (clearly referencing the exists: statement) but I can't seem to reproduce this yet. As shown, the location, source and expression reference the exists:.

After removing the exists: tal:block, the correct error is output:

TypeError: sequence item 0: expected string, int found

 - Expression: "
 - Filename:   ... files/src/templates/
 - Location:   (42:12)
 - Source:     </div>

Tested in Chameleon 2.10 and Python 2.7 (with Pyramid 1.4a2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.