[Tutor] List problem

Sharriff Aina NHYTRO@compuserve.com
Wed, 2 May 2001 18:33:11 -0400


Hi all!

from my database per CGI I get this list:

allrows =3D [(1, 'sharriff', 'sh1', 'sharriff', 'admin',
'c:\\minics\\db\\users\\aina', 'template2', 'Aina Inc.', 'Gutenbergstr.
42', '41564', 'Kaarst', 'NRW', 'Germany', '02131- 3839- 412',
'02131-3839-599', '0177-12345678', 'sa@med-iq.de', '10.104.98.70', 'Mr.
Sharriff Aina', 'Aina', 'Home,Aktuelles,None')] =


I=B4ve coded a login script (CGI) that does a very simple comparism of fi=
elds
from the database with data captured from a form


### code start ###

 fields =3D allrows[0]
 if fields[3] =3D=3D usernamevalue and fields[4] =3D=3D passwordvalue :
.... print block1, # blocks of HTML code
.... print fields[18],
.... print block2
.... print usernamevalue,
 ....print block3
elif fields[3] !=3D usernamevalue and fields[4] !=3D passwordvalue :
 ....print errorpage

#### code end ####

the problem is, when correct values are entered in the form everything
works fine as soon as one enters a false password or false username I get=

this error

"Traceback (most recent call last):
  File "cgi-bin/login.cgi", line 119, in ?
    fields =3D allrows[0]
IndexError: list index out of range

If its out of range why does it work corretly when the data filled in is
correct? the mid boggling  X-files part of it is that it works when I
simulate this code in the Python console!!

Have I overlooked something? I thought it was due to fatigue yesterday, b=
ut
I couldn=B4t get it to budge today, its worn me out. =


Could someone throw me a life jacket? I=B4m just drifting here..


Thanks

Sharriff