[Zope] Still Chipping Away At Formulator/ZPT Interface
beno
zope@thewebsons.com
Mon, 04 Nov 2002 17:11:16 -0400
At 09:43 PM 11/4/2002 +0100, you wrote:
>Hi beno,
>
> > Hi;
> > Okay, I *am* going to write a How-To on this when I get it all figured
> out
> > with your help. This needs to be done.
> > In DTML, we do this to render the fields:
> >
> > <dtml-in "form.get_fields()">
> > <dtml-let field=sequence-item>
> > <tr>
> > <td><dtml-var "field.get_value('title')"></td>
> > <td><dtml-var "field.render()"></td>
> >
> > etc. How do I do this same thing in Python? Here's the start of the code:
> >
> > mailhost=getattr(context, context.superValues('Mail Host')[0].id)
> >
> > This much works. Now, I need to be able to call the values of the
> > Formulator form (named *email_us_formulator*). An example of a value is
> > *YourEmail*. How would I access this value with Python?
>
> Maybe read the fine python tutorial ;-)
How many times? I imagine it will eventually start to sink in...
>e.g. the equivalent to "<dtml-in> are "for" loops:
>
> form = context.email_us_formulator
> for fiels in form.fields():
> print '<td>' + field.get_value('title') + '</td>'
Hmmm. This didn't work. It threw an AttributeError on *fields*. Just to be
sure, I changed your line to
for x in form.fields():
and it was the form.fields() that was erroring. Why would it work in DTML
and not in Python?
> Scott Burton has written an HowTo which may be helpful either:
>
>http://www.zopelabs.com/cookbook/1032909599
Yep. Read it many times. Before I ever wrote the list. Some of it's pretty
obtuse. And it's written specifically for password authentication: not my
application.
> It is also linked via the Formulator page on zope.org ... looking up
>the resources in the web may even be faster than asking the list ;)
I try. Really, I do :))
Thanks,
beno