[Zope] How to import files via FTP and set attributes.

Dieter Maurer dieter@handshake.de
Sun, 5 May 2002 22:35:14 +0200


Gary Speer writes:
 > ...
 > 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.
When you have a file object "F", "str(F)" gives you the file content
(a string).

When you have a string "s", "s.split(separator)" splits "s" 
at "separators" into a list of strings. Provided your CSV
separators are not imbedded into the content, applyind this twice
will parse the CSV string.

Look at the PropertyManager API (Embedded Zope help -> "Zope Help" ->
"API Reference" -> "PropertyManager") to learn how to add and
change properties (aka attributes).

Look at the "Image" API (I guess, you will find it ;-)) how to
create an Image object from a string or file.


Dieter