I created a ZClass, let's call it "TestZClass". It's a very simple ZClass -- it has an image and an index_html method. TestZClass TestImage index_html In the TestZClass_add constructor, I put in a code fragment like this: <dtml-with "TestZClass.createInObjectManager(REQUEST['id'], REQUEST)"> <dtml-call "TestImage.manage_upload(REQUEST['uploadImage'])"> </dtml-with> In the TestZClass_addForm HTML, I have: <form action="TestZClass_add" METHOD="post" ENCTYPE="multipart/form-data"> <table> <tr> <th>Id:</th> <td><INPUT TYPE="text" NAME="id" SIZE="40"></td> </tr> <tr> <th>Image:</th> <td><INPUT TYPE="file" NAME="uploadImage" SIZE="25"></td> </tr> <tr> <td></td> <td><INPUT TYPE="submit" VALUE=" Add "></td> </tr> </table> </form> What I want to do is, when the addForm HTML is called, one can upload an image and create an instance of TestZClass that overides the default TestImage in the original Class. It does override the original TestImage, but if one make another instance of TestZClass, the TestImage of all the other instances will be changed to the latest uploaded image. For example, if I create an instance of TestZClass, call it Instance1 and upload an image Image1. Instance1' TestImage will become Image1. However, if I create another instance of TestZClass, let's call it Instance2 and upload Image2, then not only Instance2's TestImage will become Image2, but Instance1's TestImage will also be changed to Image2!!! When I go back to check the TestZClass, it's very clear to me that, the TestZClass constructor change the TestImage on the ZClass, not on the instance. Anyone know how I can force it to change the TestImage in the instance, not the ZClass? Kam
Thanks for all the help I've gotten so far, I'm starting to get a better understanding of Zope. Now for my next question.... I need to do some form validation/checking on form data that is submitted such as: making text database safe determining if a number is in a certain range Checking Dates etc. As far as I can tell some of this can be done with dtml, but anything more complicated would be done either as an external method, or each check could be done as an individual PythonMethod. Right now I'm probably leaning towards the external method it seems a little cleaner than having a lot of python methods. Is that the best way to do this? And/or is there already something out there that does some of these things? Thanks again, --James
participants (2)
-
James Punteney -
Kam Cheung