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

2008-04-04 Thread Andreas Jung



--On 4. April 2008 09:50:04 +0200 Ulla Theiss <[EMAIL PROTECTED]> wrote:




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).




Please re-read my reply. You pass the path information of the object
and retrieve the object in the back using traversal.

-aj

pgpwngPq7cAX9.pgp
Description: PGP signature
___
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 )


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

2008-04-04 Thread Ulla Theiss

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 <[EMAIL PROTECTED]> 
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:





  

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.: [EMAIL PROTECTED]
 


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


___
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 )


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

2008-04-04 Thread Andreas Jung



--On 4. April 2008 09:05:59 +0200 Ulla Theiss <[EMAIL PROTECTED]> 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:




  

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



pgpqYneljHYzb.pgp
Description: PGP signature
___
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 )


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

2008-04-04 Thread Ulla Theiss


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:






But within the method addUploadFile, always the parameter doc is passed as a 
string (the name of the instance)

Does anybody know, what I have to change, that it works?

Many thanks in advance
Ulla.



___
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 )