[Zope] :records and value assignment in Python Script

Milos Prudek prudek@nembv.cz
Tue, 7 Aug 2001 09:12:05 +0200


Dne pond=ECl=ED 06 srpen 2001 16:12 jste napsal(a):
> Milos Prudek wrote:
> > Struggling with the ":records" form construct...
>
> [snip]
>
> > But how can I change the value? I tried this inside Python Script:
>
> You can enable writing of record attributes by adding this line to the
> "record" class in $ZOPE/lib/python/ZPublisher/HTTPRequest.py:
>
>    _guarded_writes =3D 1
>
> (make sure it's indented the same as the body of the class).

An easy patch... but I rather do not patch at all... I may be forced to w=
ork=20
with unpatched Zope release.

I think I'll convert :records to a list of tuples...=20

IMHO :records usefulness is quite limited because it is not mutable and=20
because it hinders iteration over <dtml-in>dtml-call APythonScript></dtml=
-in>=20
unless you pass it as a parameter. But I am very inexperienced Zoper.

AFAIK :records are useful in the web form itself to gather data.. and you=
 can=20
feed :records into ZSQL directly for data rows insertion... and that's ab=
out=20
it. If you need more, you should convert :records into some standard Pyth=
on=20
data structure that you can flexibly work with.

Please correct me if I'm wrong.

--=20
Milos Prudek