BJörn, > The Javascript in the widget calls the dosearch method and displays > the returned matches list. Now I want to generalize the code inside > dosearch, similar to how I generalized InstantTextField, so that it > can be reused. I want a controller that can return autocompletion > results for an arbitrary column in an arbitrary table: > > class CompleteController(Controller): > @expose(format = "json") > def complete(self, nr_completes, tablename, colname, input): > table = getattr(model, tablename) > cond = LIKE(getattr(table.q, colname), "%" + input + "%") > rows = table.select(cond)[:int(nr_completes)] > return dict(matches = [getattr(row, colname) for row in rows]) > > As you can see, this won't work because AutoCompleteField expected its > search_controller method only to take one argument by the name of the > search_param variable. Maybe there is a good way to solve this > problem? One way to solve it is ofcourse how to change how > AutoCompleteField works, but if you have to do that, doesn't it prove > that I'm right?
Have you thought through the security implications of providing an API that can give you a list of all the values in any column in any table? Not something I would want available on web site! Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

