Re: unicode/str not callable

2009-02-19 Thread Malcolm Tredinnick
On Thu, 2009-02-19 at 16:35 -0500, Alex Gaynor wrote: > > > On Thu, Feb 19, 2009 at 4:17 PM, Nicolas Steinmetz > wrote: > > Nicolas Steinmetz a écrit : > > > > Thanks for the answer. I'll implement the 2nd method, which > makes

Re: unicode/str not callable

2009-02-19 Thread Alex Gaynor
On Thu, Feb 19, 2009 at 4:17 PM, Nicolas Steinmetz wrote: > > Nicolas Steinmetz a écrit : > > > > Thanks for the answer. I'll implement the 2nd method, which makes far > > more sens than my first "harsh and straight away" approach ;-) > > Solution was finally : > >

Re: unicode/str not callable

2009-02-19 Thread Nicolas Steinmetz
Nicolas Steinmetz a écrit : > > Thanks for the answer. I'll implement the 2nd method, which makes far > more sens than my first "harsh and straight away" approach ;-) Solution was finally : try: tips ={'google': google(request.POST['search'], number),

Re: unicode/str not callable

2009-02-18 Thread Nicolas Steinmetz
Malcolm Tredinnick a écrit : > Method #2: create a dictionary mapping "engine" values to the right > callable. > > try: > {'google': google, > 'yahoo': yahoo, > # ... > }[engine](...) > except KeyError: > # Engine

Re: unicode/str not callable

2009-02-18 Thread Malcolm Tredinnick
On Thu, 2009-02-19 at 00:43 +0100, Nicolas Steinmetz wrote: [...] > The issue is that engine in engine(request.POST['search'], 10) does not > become google(request.POST['search'], 10) in the case where the user > chosed "google" as engine. > > Is there a solution or did I have to test all

unicode/str not callable

2009-02-18 Thread Nicolas Steinmetz
Hello, I have in mind in a tiny app to allow user to set a search box with the provider they wish. I base this on web_search and then did the following : # Create your models here. class SearchBox(models.Model): CROP_ANCHOR_STR = ('dmoz', 'ask', 'google', 'googlefr', 'excite', 'msn',