manage_addFile - ErrorValue: seek
Hi, 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_addDocument('standard_html_footer', 'Website Standard Footer', HTMLFile('DTML_Methods/standard_html_footer', globals())) -> works perfectly !! handle.manage_addFile('Style Sheet', HTMLFile('DTML_Methods/css/styles.css', globals()), 'Title of File') -> Error Type: AttributeError Error Value: seek handle.manage_addFile('Style Sheet', 'Title of File', HTMLFile('DTML_Methods/css/styles.css', globals())) -> works, but the Content of the File is 'Title of File', and within ZOPE the Title is the Content of the File !! How does this work correctly please?
perhaps if you explicitly name your parameters: handle.manage_addFile(id='stylesheet.css', title='Title of File', file=some_file) as manage add file takes 5 parameters and you are only passing in 3. the other 2 are precondition and content_type just a thought. Bernhard Kahlbacher wrote:
Hi,
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_addDocument('standard_html_footer', 'Website Standard Footer', HTMLFile('DTML_Methods/standard_html_footer', globals())) -> works perfectly !! handle.manage_addFile('Style Sheet', HTMLFile('DTML_Methods/css/styles.css', globals()), 'Title of File') -> Error Type: AttributeError Error Value: seek handle.manage_addFile('Style Sheet', 'Title of File', HTMLFile('DTML_Methods/css/styles.css', globals())) -> works, but the Content of the File is 'Title of File', and within ZOPE the Title is the Content of the File !!
How does this work correctly please?
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- "I am not part of the problem. I am a Republican." -- Gov. George W. Bush Jasoe Bush | (402) 471-6517 | jason@nol.org | http://www.nol.org
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
participants (3)
-
Bernhard Kahlbacher -
Dieter Maurer -
Jason Bush