debugging TAL?

classic Classic list List threaded Threaded
5 messages Options
Chris Curvey-2 Chris Curvey-2
Reply | Threaded
Open this post in threaded view
|

debugging TAL?

I'm trying to customize the navigation portlet, but I've messed
something up.  All I'm getting in the Zope event log is:

Plone Debug Error Products.PageTemplates.PageTemplate.PTRuntimeError on
Page Template portlet_navigation has errors. while rendering portlet
here/portlet_navigation/macros/portlet

Nothing is showing up in the zope error log (visible thru the ZMI) or
the plone error log (visible thru site setup).

There has to be a better way to work with TAL than just trial-and-error.



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Duncan Booth-4 Duncan Booth-4
Reply | Threaded
Open this post in threaded view
|

Re: debugging TAL?

Chris Curvey wrote:

> I'm trying to customize the navigation portlet, but I've messed
> something up.  All I'm getting in the Zope event log is:
>
> Plone Debug Error Products.PageTemplates.PageTemplate.PTRuntimeError on
> Page Template portlet_navigation has errors. while rendering portlet
> here/portlet_navigation/macros/portlet
>
> Nothing is showing up in the zope error log (visible thru the ZMI) or
> the plone error log (visible thru site setup).
>
> There has to be a better way to work with TAL than just trial-and-error.
>
PTRuntimeError means you tried to render a page template which failed to
compile. If you edited the file on disc, use the ZMI to view the template
source and you'll see the error message. If you are editing it though the
web just reload it into your editor and you should see the error message at
the top of the file.

In general, the best way to debug page templates is avoid ever having to
debug them. Do your very best to avoid putting any kind of code or logic
directly into a page template. Instead always create a class in Python
which has a bunch of attributes for all the values you need to put on the
page. Then if you get an error anywhere it will probably be in your Python
code. (Five has views for this, but even without Five you can aim for the
same thing.)

Of course, if you are editing an existing template this might not be the
easiest thing to do.



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Nick Davis Nick Davis
Reply | Threaded
Open this post in threaded view
|

Re: debugging TAL?

In reply to this post by Chris Curvey-2

>
> There has to be a better way to work with TAL than just trial-and-error.
>

I completely agree, but haven't found a solution yet. This is
problematic for us too.

If you end up at the Plone error page it doesn't tell you a great deal.
Its useful for an Attribute Error but not if there's a syntax error
somewhere in a page template.

One thing I do sometimes is, in the ZMI, go to the offending template
and click Test to see if this gives a clue. Also in the ZMI if you try
to save a page template which has an error, it tells you what the error
is. You could cut and paste code from your page template file into the
ZMI and try to save it and see what happens. This is a ridiculous thing
to have to do though.

Also a problem with this approach is if you test the template through
the ZMI it may throw other errors due to the Plone context not being there.

I think the error reporting system which is built in to Plone 2.1 may
give more info.

Hopefully someone else will post a better answer..........

Nick



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Nick Davis Nick Davis
Reply | Threaded
Open this post in threaded view
|

Re: debugging TAL?

p161 Andy Mackay Definitive Guide to Plone has a useful way to check
page templates.



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Stephen Kenworthy Stephen Kenworthy
Reply | Threaded
Open this post in threaded view
|

Re: debugging TAL?

In reply to this post by Chris Curvey-2
Chris Curvey wrote:

> Plone Debug Error Products.PageTemplates.PageTemplate.PTRuntimeError on
> Page Template portlet_navigation has errors. while rendering portlet
> here/portlet_navigation/macros/portlet

A runtime error usually means something is wrong in the template code.
Its not a syntatic error but a more logical one. Try actually viewing
the template i.e. http://your_plone_server/portlet_navigation *In some
cases*, I have found this useful for debugging portlets (doesn't always
work though).

> There has to be a better way to work with TAL than just trial-and-error.
>

There are other methods. Check out
http://zopewiki.org/DebuggingPageTemplates

HTH

--
Stephen Kenworthy
www.globalhand.org



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users