[Zope] Zope 0.9 External Methods
Alex Rice
alrice@swcp.com
Sun, 15 Aug 1999 17:08:12 -0600 (MDT)
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