Insane Problem

Victor Subervi victorsubervi at gmail.com
Thu Dec 3 06:07:55 EST 2009


On Wed, Dec 2, 2009 at 4:08 PM, MRAB <python at mrabarnett.plus.com> wrote:

> Victor Subervi wrote:
>
>> Hi;
>> I have spent 2-3 hours trying to track this bug. Here's the code snippet:
>>
>>  form = cgi.FieldStorage()
>>  fn = getattr(options, 'products')
>>  ourOptionsNames = []
>>  optionsNames, doNotUse  = fn('names')
>>  for name in optionsNames:
>>    test = table + '-' + name
>>    print test
>>    check = form.getfirst(test, '')
>>    print check
>>    if check != '':
>>      ourOptionsNames.append(name)
>>  Now, when it looks through with test=='products', it doesn't report that
>> any of the values from the form are checked. However, when I explicitly
>> write out something like:
>> print form.getfirst('products-sizes', '')
>> which I checked on the form from the referring page, it does in fact print
>> out! My test prints show that 'products-sizes' is being passed to "check"
>> and should therefore be appended to "ourOptionsNames". But it isn't! What am
>> I missing here??
>>
>>  What do the print statements actually print? Please copy and paste their
> output.
>

For the part in question they print __nothing__. That's the point.
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091203/4ce3792c/attachment-0001.html>


More information about the Python-list mailing list