[Tutor] A problem, but where?

Michael P. Reilly arcege@shore.net
Mon, 4 Oct 1999 20:31:18 -0400 (EDT)


> I have a program I'm working on that's a CGI and I've had this problem
> crop up a few times. Before, I've worked around it but somehow I think
> I've hit a genuine issue. I'm just not sure if it's me doing something
> stupid (you know how hard it is to be objective about your own code).
> 
> The original code can be found at http://www.deirdre.org/ebaycgi.py and
> the included structures can be found at
> http://www.deirdre.org/bidStructs.py
> 
> The problem occurs around line 277:
> 
>   self.parseRecord(form)
>   print self.a.auctionId
> 
> In the parseRecord method, it prints self.a.auctionId twice. Correctly. It
> is set the once and never re-set.
> 
> However, in the calling method, it is NOT set. This is what I get as
> output:
> 
> 169763363
> 169763363
> 
> Auction No                   : 
> Auction Title                : Recycled [etc.]
> 
> The first two lines are the parseRecord method's printing, the blank line
> is line 278 (not printing), same on the right side of the colon.

What I notice (somewhat) right away is:
 def parseRecord(self, form):
  self.initVars()

  try:
   a = form["auctionid"] # extract auction number
   b = a.value
   self.a.auctionid = string.strip(b)
   print self.a.auctionid
  except:
   pass

But lower down you have:
  self.parseRecord(form)
  print self.a.auctionId

A captitalized "I" is probably the problem.

  -Arcege

-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Engineer | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------