FOR LOOPS

OriginalBrownster originalbrownster at gmail.com
Mon Jul 31 23:02:22 EDT 2006


I am using a class called UploadedFile.
I want to create a for loop to itterate through the objects within file
name

class UploadedFile(SQLObject):
	filename = StringCol(alternateID=True)
	abspath = StringCol()
	uniqueid = IntCol()

I'll show you a snippit of the code I am trying to use it in::


        zip= ["zip.txt"]
        file_path = [myfile.filename for myfile in
UploadedFile.select(orderBy=UploadedFile.q.filename)]

        if kw:
            for filename in file_path:
                zip.append(filename)
            flash('Options selected'+ str(kw) + str(zip))
        else:
            pass

When i run this the flash displays all the values for kw...however zip
only shows up as "zip.txt" using the str function. Meaning that the FOR
LOOP is not working correctly.

Any ideas why this is happening?? perhaps someone could shoe me how to
make a proper list for this if this is incorrect.

Thank you




More information about the Python-list mailing list