Attention

This document was written for an unsupported version of Plone, Plone 2.0.x, and was last updated 1600 days ago.

For more information, see the version support policy.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Nested page template errors

by Martin Aspeli last modified Dec 30, 2008 03:08 PM
Contributors: Martin Aspeli
If you have a page template which uses a macro, and the page template which defines the macro has an error, it's difficult to track down the error.

Say you have an Archetypes widget with its own view macro, or any other situation where you have a main page template which is using macros via metal:use-macro, defined in another file. If the "inner" macro - the one included by the main macro - has a PageTemplate syntax error, you may see an error like the following:

  Site error

  This site encountered an error trying to fulfill your request. The errors were:

  Error Type
      RuntimeError
  Error Message
      FS Page Template base_view has errors:    
  Products.PageTemplates.PageTemplate.PTRuntimeError.
      <pre>Page Template widget_imagesmanager has errors.</pre>
  Request made at
      2004/09/28 22:09:09.671 GMT+1

Clearly, the error is in widget_imagesmanager.pt (the included widget), but you are not told where or what is wrong.

To find out more information about the error, you can call the included page template directly. For instance, if you got this error from the template

http://myplonesite.com/documents/mydocument/base_view

you could go to

http://myplonesite.com/documents/mydocument/widget_imagesmanager

Obviously, substitute the name of the page template and the URL of your content object as appropriate.

If this gives you a "compilation failed" error, you'll be able to find out the exact tag and line number that's causing the template to fail. When you've fixed all "compilation failed" type errors, you may still get other errors (e.g. a "KeyError" or "NameError") because the page template is not expecting to be called on the content object directly. But it should now compile correctly and be correctly included in the outer macro.