[ZPT] How to accomplish attribute update from file content

Gary Speer gspeer@linkline.com
Fri, 3 May 2002 09:39:24 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0223_01C1F286.69442E60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Sorry this is in ZPT, I realize its not specifically template related, =
but a template with script calls would be the preferred result. =20
I'm mildly experienced at Zope, yet haven't found the 'simple' way to =
execute the following.  I been going in circles on this and all help =
would be appreciated.  Rather than correct the approaches I have been =
trying, I think it best to get some fresh perspectives.

Objective:  User FTPs a batch of files into an empty zope folder along =
with a text document called contents.txt.
contents.txt has one line per uploaded file in CSV or similar parseable =
layout that begins with the file name.
After the upload, the user triggers a posting process (a 'process the =
upload' form buttom with Action=3DDo_It().
The executed Do_it object reads the text file and loops once per line, =
for each line, it parses it into a file name and several attributes. =20
The object then writes the uploaded file content to a target folder as a =
zope object having these attributes.

I am stuck at looping on and parsing the content of the contents.txt =
file to get and pass the attributes to the add object method.  =
Suggestions, syntax, or pointers to how-tos all gratefully accepted.
Thank you!
Gary

------=_NextPart_000_0223_01C1F286.69442E60
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>Sorry this is in ZPT, I =
realize its=20
not specifically template related, but a template with script calls =
would be the=20
preferred result.&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>I'm&nbsp;mildly =
experienced at Zope,=20
yet haven't found the 'simple' way to execute the following.&nbsp; I =
been going=20
in circles on this and all help would be appreciated.&nbsp; Rather than =
correct=20
the approaches I have been trying, I think it best to get some fresh=20
perspectives.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>Objective:&nbsp; User =
FTPs a batch of=20
files into an empty&nbsp;zope folder along with a text document called=20
contents.txt.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>contents.txt has one =
line per=20
uploaded file in CSV or similar parseable layout that begins with the =
file=20
name.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>After the upload, the =
user triggers a=20
posting process (a 'process the upload' form buttom with=20
Action=3DDo_It().</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>The executed Do_it =
object reads the=20
text file and loops once per line, for each line, it parses it =
into&nbsp;a file=20
name and several attributes.&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>The object then writes =
the uploaded=20
file content to a target folder as a zope object having these=20
attributes.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>I am stuck =
at&nbsp;looping=20
on&nbsp;and parsing the content of the contents.txt file to&nbsp;get and =
pass=20
the attributes to the add object method.&nbsp; Suggestions, syntax, or =
pointers=20
to how-tos all gratefully accepted.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 size=3D2>Thank you!</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080 =
size=3D2>Gary</FONT></DIV></BODY></HTML>

------=_NextPart_000_0223_01C1F286.69442E60--