[Zope] Passing an instance in a form to a product method

Ulla Theiss u.theiss at eurodata.de
Fri Apr 4 03:50:04 EDT 2008


Hello List,

first, many thanks for the very fast and polite answer. I already know 
the Zope-Book for many years, but I did not find a solution there, for 
my special problem.

Perhaps I have to give a little bit more context to you. I tried to make 
the code-excerpt short - perhaps too short.

The object doc has nothing to do directly with uploading the file. In 
this object is some further information. And to do things in a handy 
way, I need that further information (doc) in the method, called after 
submitting the form (addUploadFile).

Is there a solution for that available?

Again, many thanks in advance,
Ulla.


Andreas Jung wrote:

>
>
> --On 4. April 2008 09:05:59 +0200 Ulla Theiss <u.theiss at eurodata.de> 
> wrote:
>
>>
>> Hello List,
>>
>> I have to pass an instance of a self-defined class within a form to a
>> product method.
>> I try it in the following way:
>>
>> <form action="addUploadFile" enctype="multipart/form-data" target="main"
>> method=post>
>> <input name="doc:instance" value="<dtml-var doc>" type="hidden">
>
>               ^^^^^^^^^^^^
>
> Please don't invent new syntax or new APIs...or don't expect that stuff
> like this would work because you dream of it :-)
>
> And of course you can not *pass* instances in some way through HTTP.
> This makes totally no sense.
>
> No idea what your intention is with your code. If you specify
> 'addUploadFile' then this method will be called within the context
> of your current object. If you need to call the method within the context
> of an other object, specify the URL of the related object within 
> 'action'.
> If you need reference another object as part of your form-data: specifiy
> its *path* but passing the object directly to value=".." really makes 
> no sense. Obtain an object-by-path within your code using the 
> restrictedTraverse() API. But for uploading data to your current 
> context object you don't have to define something like "doc"... please 
> refer
> to the "Zope Book 2.7 edition" - appearently you have a basic 
> misunderstanding how Zope works here.
>
> Andreas
>

-- 


Theiß Ulla
Softwareentwicklung
Grossblittersdorferstrasse 257-259
66119 Saarbruecken
Germany
Tel.:  +49 (681) 8808-0       
Fax.:  +49 (681) 8808-300        
E-Mail.: u.theiss at eurodata.de    
  

EURO DATA GmbH & Co. KG
Datenverarbeitungsdienst
HR A 6448 Amtsgericht Saarbrücken
Komplementär: A. Reiß & Sohn GmbH
HR B 4965 Amtsgericht Saarbrücken
Geschäftsführer: Dipl.-Kfm. Karl-Heinz Siebenpfeiffer




More information about the Zope mailing list