Re: cheetah is extremely hard to debug - error messages are non indicative TypeError: cannot concatenate 'str' and 'int' objects

"R. Tyler Ballance" <[email protected]>
Newsgroups gmane.comp.python.cheetah,gmane.comp.python.tutor
Message-ID <[email protected]>
On Thu, May 14, 2009 at 12:20:42PM -0700, [email protected] wrote:
>    How do i find which variable has error in these error messages?
> 
>    Nonetype  object is unsubscriptable
> 
>    else:return web.render('searchesnew.html')
>      File "/home/mark/work/common/web/cheetah.py", line 103, in render
>        return str(compiled_tmpl)
>      File
>    "/usr/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux-i686.egg/Cheetah/Template.py",
>    line 982, in __str__
>        def __str__(self): return getattr(self, mainMethName)()
>      File "<string>", line 323, in respond
>    TypeError: cannot concatenate 'str' and 'int' objects


I'm not really sure what you expect Cheetah to do for you? It can't
really hold your hand and point you to an error automagically because
like most compilers it doesn't understand what you "meant" but only what
you told it ;)

The first error is fairly easy to grok, just not sure where you'd find
it without a backtrace, it's a simple `None['foo']` or `None[0]`

The second is another relatively simple error `'1' + 2`. The problem
with both is that you're not going to get "true" and proper backtraces
because you're using dynamically compiled templates, so Python doesn't
exactly have lines of code to refer back to since the objects were
dynamically created.

If you were to compile searchesnew.html down to a searchesnew.py and
then execute it in a similar fashion, you'd get a "proper" Cheetah
backtrace like this:

		File "base.py", line 413, in respond
		  _v = VFFSL(SL,"page_body",False)() # '$page_body()' on line 51, col 3
		File "foo/base.py", line 100, in page_body
		  _v = VFFSL(SL,"page_content",False)() # '$page_content()' on line 19, col 2


Cheers

-- 
-R. Tyler Ballance
Slide, Inc.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkoMqV0ACgkQFCbH3D9R4W9pdgCfdxKmYe33sde4bUpflVeSjeSA
igwAoJ3bCOBwfWrv6mFGXRK/tKuIKWSS
=DlGz
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.