On Thu, Feb 19, 2009 at 4:17 PM, Nicolas Steinmetz <[email protected]>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 :
>
> try:
> tips ={'google': google(request.POST['search'], number),
> 'googlefr': googlefr(request.POST['search'], number),
> 'dmoz': dmoz(request.POST['search'], number),
> 'ask': ask(request.POST['search'], number),
> 'yahoo': yahoo(request.POST['search'], number),
> 'msn': msn(request.POST['search'], number),
> 'excite': excite(request.POST['search'], number)}.get(engine)
> except KeyError:
> tips=google(request.POST['search'], number)
>
>
> Thanks,
> Nicolas
>
>
> >
>
Remember when you do that it's going to call every single one of those
functions regardless of which engine is actually selected.
Alex
--
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---