Thanks much for your valuable replies.  Here's what I now have, after
your suggestions, but it doesn't seem to be working.  I adding a call
to user_folders to my index method to test it and display the results
with a for loop in the template, but I get an error saying "folders is
not defined" - which I'm a little confounded over, as I can't see any
reason for it to not be defined.  I've looked for typo's, but perhaps I
overlooked one.

class UploadFile(controllers.Controller):
        def upload_form(self):
                upload_form=widgets.TableForm(fields=[
                        widgets.FileField('file',label="File to
upload:"),
                        widgets.AutoCompleteField('folder',
                                only_suggest=True,
                                label="Folder to put file in:",
                                search_controller="search",
                                search_param="input",
                                result_name="matches")
                                ],
                                submit_text="Upload file",
                                action="/save_file",
                                method="POST")

        def user_folders(self):
                user=identity.current.user.user_name
                folderdblist=Folder.select(Folder.q.user==user)
                folders=[]
                for folder in folderdblist:
                        folders+=[folder.folder]
                return folders

        @expose(format = "json")
        def search(self,input):
                input=input.lower()
                folders=user_folders()
                matches = [folder for folder in folders \
                        if folder.lower().find(input)!=-1]
                return dict(matches=matches)

        @expose(template="photogal.templates.upload")
        def index(self):
                folders=user_folders()
                return dict(upload_form=upload_form,folders=folders)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to