[Zope] Python Script

Martin Gebert Murphy@members.netsolution-net.de
Thu, 16 Jan 2003 02:18:26 +0100


Jonathan Miles schrieb:

>Can someone help me with this.
>
>I just want to run the salescheck sql method and use a field 'OFFICENAME' in
>the result set in the message.
>
>It is a simple task and it's been bugging me far to long.
>
>Thank for your help.
>
>
>orderrecordok = context.salescheck(locationid = request.LOCID, RECID =
>request.ID)
>
>if not orderrecordok:
>
>   return context.REQUEST.RESPONSE.redirect("%s?message=%s" %
>(context.REQUEST.URL1,' Sorry the Order ' + salescheck.OFFICENAME + ' is not
>yours'))
>
Hmm, and what exactly is your problem?

But I already see some issues.
First, you should check that OFFICENAME comes from the right source. 
What you're doing here is calling the method or attribute "OFFICENAME" 
from the object "salescheck" (which either is a SQL method and thus 
probably has no such member, but then the leading "context." is missing; 
or it's a variable you defined before). And you can't get it from your 
result named "orderrecordok", 'cause you just checked that for being 
empty...
Another point could be that the message must appear within quotes in the 
URL, but I'm not sure about that.
Try again, and *please* post with a more detailed description of your 
*problem* (including error messages etc.) next time...

Martin