[Zope] Python Script

Dieter Maurer dieter@handshake.de
Thu, 16 Jan 2003 21:46:40 +0100


Jonathan Miles wrote at 2003-1-16 00:21 -0000:
 > 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'))
Apparently, when you run "salescheck", it returns an empty result
set.
Of course, you cannot access a field in an empty result set.

If you have a non-empty result set "R", then "R[i]" is the i-th
result row (0-based) and "R[i].OFFICENAME" would give you
the "OFFICENAME" field of this row.


Dieter