Hi; I have this code: for table in tables: if table == 'products': optionsCode = optionsCodeProducts fromForm = prodsFromForm try: fn = getattr(options, table) fromForm = form.getfirst('%s-options' % table) fromForm = string.split(fromForm[2:-2], "', '") optionsCode = fn(table, 'specificCode', fromForm) except: if table != 'products': # We recall we must add the products table fields to all tables. optionsCode = optionsCodeProducts i = 0 j = 0 oldJ = 0 try: y = 0 while y < len(optionsCode): if table == 'prescriptions': print len(optionsCode) # prints '2' for inputName in optionsCode[y]: if table == 'prescriptions': print len(optionsCode[y]) # prints '7' print inputName # prints 'Extra-small', which is only the first inputName in optionsCode[0] if j != oldJ: i = 0 oldJ = j x = '%s-%s%d' % (table, fromForm[y], i) x = form.getfirst(x) if x is not None: ourInputNames.append('%s-%s' % (table, inputName)) i += 1 j += 1 y += 1 except: pass
As you can see in the supplied comments, when I loop through for table 'prescriptions', it only prints out the first element of each variable. When I loop through for table 'products', it prints out all of them! Why? TIA, Victor
-- http://mail.python.org/mailman/listinfo/python-list