[Zope] adding ZClass with python script problem
Tom Germaine
tgermaine@upei.ca
Tue, 01 Oct 2002 11:38:18 -0300
Hi All,
I have a ZClass object that I would like to instantiate using an upload
form and a python script. The ZClass object is subclassed from
CatalogAware and DTMLDocument. My upload form has 3 fields -
file=myfile, id=ident, title=mytitle:
<form action="uploadActionScript" method="post"
enctype="multipart/form-data">
<p><input type="file" name="myfile" size="85"></p>
<p>Filename: <input type="text" name="ident "
size="70"></p>
<p>Title: <input
type="text" name="mytitle" size="70"></p>
<input type="submit">
</form>
and the python script to instantiate the object:
....
client=context.myfolder
....
getattr(client.manage_addProduct['MyProduct'], \
'MyZClass').createInObjectManager(ident,context.REQUEST)
.......
This does add an instance of my ZClass to myfolder, with id of ident
but without content and title. I tried
getattr(client.manage_addProduct['MyProduct'], \
'MyZClass').createInObjectManager(ident, myfile, \
mytitle, context.REQUEST)
and
propertysheets.MyZClass.manage_editProperties \
({'file':myfile,'title':mytitle},context.REQUEST)
but these fail too.
How should I go about including the contents and title of my upload
file into my new ZClass object?
Tom Germaine
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Tom Germaine
System Administrator
UPEI Access Services
tgermaine@upei.ca
566-0465
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~