[ZPT] Replacing templates in place?

jmr@computing.com jmr@computing.com
Thu, 17 May 2001 16:52:29 -0500 (CDT)


I've noticed something I don't understand (and don't like..:):

We have a "master_page" template; it defines a "main" slot that other
pages use.  If we replace this template with a new version, some pages
break and others don't.

   ("replace" means "delete or rename the old one; put a new one in its place")
   ("break" is described by the trace I've included below.)

   ("sample page", below, means any one of several pages that uses the
master macro in the master_page.)

Questions:

1.) by the time that we ask the sample page to be rendered, there is a
functioning master_page that is findable (it's in the root).  Why does
it say "not found"?

2.) this malfunction can be fixed by simply opening the sample page in
the manage_edit window and saving it.  After that it renders again.
Why does it have to be saved?  Is there a way around this?

3.) only some pages out of the set of all pages using master_page
behave this way; some of them work just fine without having to
edit/save.  I can't find a pattern as to when it works and when it
doesn't.  Why the variance?

The workaround we've discovered amounts to "don't do that!".  However,
this means more work, and perhaps more errors -- one thing we like to
do is to test the "master_page" somewhere other than in the top
directory; in order to do this it means remembering all the changes
made the in the test version and re-doing the changes in the official
version using the TTW edit form.  This isn't always the most effective
way to work... :)

The trace is below..  Thanks!

Jim Rowan
DCSI
jmr@computing.com

<!-- Page Template Diagnostics
 Macro expansion failed
 Products.PageTemplates.TALES.Undefined: "master_page" not found in "here/master_page/macros/master"
 ('/usr/local/share/zope-2.3.2/lib/python/OFS/Application.py', 247, '__bobo_traverse__', 'raise KeyError, name')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/Expressions.py', 417, 'restrictedTraverse', 'o=t(REQUEST, name)')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/Expressions.py', 223, '_eval', 'return restrictedTraverse(ob, path)')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/Expressions.py', 178, '_evalRender', 'return render(self._eval(econtext), econtext.contexts)')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/Expressions.py', 228, '__call__', 'return getattr(self, self._call_name)(econtext)')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/TALES.py', 278, 'evaluate', 'return expression(self)')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/TALES.py', 303, 'evaluateMacro', 'return self.evaluate(expr)')
 ('/usr/local/share/zope-2.3.2/lib/python/TAL/TALInterpreter.py', 399, 'do_useMacro', 'macro = self.engine.evaluateMacro(macroExpr)')
 ('/usr/local/share/zope-2.3.2/lib/python/TAL/TALInterpreter.py', 225, 'interpret', 'apply(method, args)')
 ('/usr/local/share/zope-2.3.2/lib/python/TAL/TALInterpreter.py', 198, '__call__', 'self.interpret(self.program)')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/PageTemplate.py', 155, 'pt_render', 'tal=not source, strictinsert=0)()')
 ('/usr/local/share/zope-2.3.2/lib/python/Products/PageTemplates/PageTemplate.py', 186, 'read', 'return self.pt_render(source=1)')
-->
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      metal:use-macro="here/master_page/macros/master">
    <head>
      <title tal:content="here/title">The title</title>
</head>       

<body background="images/dcsi_background.jpg" bgcolor="#ffffff" vlink="#3300bb" link="#3300bb" alink="#d3d3d3" marginwidth="0" marginheight="0">
<!--Begin Header Navigation-->
<div align="center">