Zope 0.9 External Methods
I know I'm living in the past, but I just haven't had any time to upgrade. So please forgive me, and try to understand. I need to know how to do the following: 1) Pass arguments from a form submission to an external method. Right now, I have a checkbox, say, chkDialup, which when checked holds the value of 'y'. When unchecked, the symbol "chkDialup" is undefined, and so I default it to 'n' in the external method, like so: def PriceQuote( self, ..., chkDialup='n', ... ) The problem is, REGARDLESS OF THE VALUE ACTUALLY HELD BY CHKDIALUP, THE FUNCTION ALWAYS TREATS IT AS HOLDING THE VALUE OF 'n'!! Why? 2) How can I include the contents of a document in the output of the external method? I'm trying to do this: def PriceQuote( self, ...args... ): RESULT = self.pre_content RESULT = RESULT + "some sample <b>HTML</b> text here." return RESULT The problem here is that executing RESULT = self.pre_content, it converts the thing into a plain text; in other words, it converts <b> into <b>. How in the world do I get Zope to treat the file /verbatim/ instead of trying to second-guess what I mean? Thanks in advance for the advice and assistance. It's greatly appreciated. If it seems like I'm a bit "edgy", it's because I'm under a pretty severe time constraint on this project (it needs to be done in two days!). I apologize in advance fro any huffiness on my part. ========================================================================== KC5TJA/6 | -| TEAM DOLPHIN |- DM13 | Samuel A. Falvo II QRP-L #1447 | http://www.dolphin.openprojects.net Oceanside, CA |......................................................
On Fri, Aug 13, 1999 at 05:36:03PM -0700, Samuel A. Falvo II wrote:
If it seems like I'm a bit "edgy", it's because I'm under a pretty severe time constraint on this project (it needs to be done in two days!). I
Make that tomorrow now... :-) ========================================================================== KC5TJA/6 | -| TEAM DOLPHIN |- DM13 | Samuel A. Falvo II QRP-L #1447 | http://www.dolphin.openprojects.net Oceanside, CA |......................................................
On Fri, 13 Aug 1999 17:36:03 -0700, "Samuel A. Falvo II" <kc5tja@dolphin.openprojects.net> said: Samuel> I know I'm living in the past, but I just haven't had any time Samuel> to upgrade. So please forgive me, and try to understand. I've never used earlier than < 1.0, so I don't know if my response is accurate. Samuel> def PriceQuote( self, ..., chkDialup='n', ... ) How about this? def PriceQuote(self, REQUEST, RESPONSE): That way you can access REQUEST['chkDialup'] and whatever other data you need from the form submission. Samuel> The problem is, REGARDLESS OF THE VALUE ACTUALLY HELD BY Samuel> CHKDIALUP, THE FUNCTION ALWAYS TREATS IT AS HOLDING THE VALUE OF Samuel> 'n'!! Why? You are setting 'n' as the default value for chkDialup the method parameter... maybe that's why? How are you calling this method in your dtml? Try getting the value from REQUEST directly and setting your form to: <form action="my_external_method" method=post> And using REQUEST as a parameter in your method. Samuel> 2) How can I include the contents of a document in the output of the Samuel> external method? I'm trying to do this: Samuel> def PriceQuote( self, ...args... ): Samuel> RESULT = self.pre_content Samuel> RESULT = RESULT + "some sample <b>HTML</b> text here." Samuel> return RESULT The following works in Zope2.0-b4. If prepend is a dtml document in the current directory, this returns it's raw content appended with 'blah' def append(self): reply=self.prepend.raw reply=reply+ "\n\nblah blah blah..." return reply I'm not saying that's the best way, but it works. Remember you can always use python's dir() to see what properties an object has. This is especially helpful in external methods where you are executing in the midst of the Zope space. Samuel> Thanks in advance for the advice and assistance. It's greatly Samuel> appreciated. If it seems like I'm a bit "edgy", it's because Samuel> I'm under a pretty severe time constraint on this project (it Samuel> needs to be done in two days!). I apologize in advance fro any Samuel> huffiness on my part. Good luck. -- Alex Rice | alrice@swcp.com | http://www.swcp.com/~alrice Current Location: N. Rio Grande Bioregion, Southwestern USA
participants (2)
-
Alex Rice -
Samuel A. Falvo II