object in Zope
J Cameron Cooper
Sat, 29 Mar 2003 15:30:59 -0600
>become an object in zope. I have already tried to use manage_addFile,
>but it doesnt seem to find the file. In Zope mangement view its easy
>enough to create a txt-file and get it on working, but when I want to
>do the exact same thing in a Product created with Python, it just
>So far I have also tried to find some other objects that I might use
>instead of manage_addFile, but havent succeded yet.
I'm mildly confused as to what you're trying to do here, and I suspect
that's because you are too.
If you want to simply create a single object in your ZODB containing the
your js file for upload. Change the content type to text/plain or
CSS all the time.
To add a File from python code, you must give it a fileish object or a
string containing the contents as the 'file' parameter. That means that
you must find the file via its path and create a Python file-ish object
(usually by way of the built-in open() method) or read its contents into
a string. This you can pass to manage_addFile. It won't deal with a path.
Selecting the file and getting the data in the proper format is done
automatically by your browser for the input type of 'file'. Outside it,
you must do it yourself.
to write your own 'manage_addWhatever' function to be called from the
web or other Products. It can be almost identical to manage_addFile, but
you must call your new Product's class constructor, and not the File one.