[ZPT] ZPT for manage_addForm

Michael R. Bernstein mbernstein@codeit.com
27 Feb 2002 09:00:42 -0800


On Tue, 2002-02-26 at 19:12, Michael R. Bernstein wrote:
> On Thu, 2002-02-14 at 12:20, cccurvey wrote:
> > Hi all,
> > 
> > I'm working through some of the product examples, and I'd like to use 
> > a ZPT page rather than a DTML page for the form that calls my 
> > constructor.    I had everything working with DTML, but as soon as I 
> > try to change to ZPT, I get the "Zope Quick Start" page when I try to 
> > add a new instance of my product.
> > 
> > The code in my product class file looks like:
> > 
> > --------
> > manage_addForm = PageTemplateFile("www/manage_addForm", globals())
> > constructors = (manage_addForm, manage_addAction)
> > --------
> 
> I'm seeing this same problem (Zope 2.5.0) and another developer has
> confirmed that the problem does *not* exist with 2.4.3 + ZPT.

Further followup:

Steve Alexander (on #zope) asked what ZPTs used as their add form, and I
found the following in ZopePageTemplate.py:

# Product registration and Add support
manage_addPageTemplateForm = PageTemplateFile(
    'www/ptAdd', globals(), __name__='manage_addPageTemplateForm')

Adding the __name__='manage_addForm' parameter to the code in my product
makes it work.

This seems to be a difference between PageTemplateFiles in Zope 2.5 and
PageTemplates 1-4-1.

Anyway, I'm not certain anymore whether this is a bug or a design
decision for 2.5, as DTMLFiles don't require anything similar in 2.5.

Any ideas?

Michael Bernstein.
-- 
---------------------------------------------------
| Michael Bernstein   http://michaelbernstein.com |
|                                                 |
| CodeIt Computing    http://codeit.com           |
---------------------------------------------------