[Zope] manage_addFile - ErrorValue: seek

Dieter Maurer dieter@handshake.de
Fri, 13 Jun 2003 22:57:57 +0200


Bernhard Kahlbacher wrote at 2003-6-12 19:57 +0200:
 > I don't know what I made wrong here but as it doesn't work, something
 > must be wrong.
 > I try to attach Files to a Folder.
 > ....
 > 	handle.manage_addFile('Style Sheet',
 > HTMLFile('DTML_Methods/css/styles.css', globals()), 'Title of File') ->
 > Error Type: AttributeError
 > Error Value: seek

"manage_addFile" expects a Python file object (or a string) as
value for its "file" argument.

"HTMLFile" is not a Python file object. The "File" in its name
does not refer to "file likeness" but to the template source being
a file.

If you are in an External Method, you can use:

   handle.manage_addFile('Style Sheet', # ATT: you should not have whitespace in ids!
			 open(path_to_your_file),
			 'Title of File',
			 )


Dieter