cardapio should pass requested result count to plugins

Bug #614710 reported by Paweł Bara
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cardapio
Fix Released
Undecided
Unassigned

Bug Description

instead of the long_search flag it should probably provide an int with the current item count (let's call it 'result_count').

this would reduce code duplication. no more:

"# take the maximum number of results into account
self.results_limit = self.cardapio.settings['search results limit']
self.long_results_limit = self.cardapio.settings['long search results limit']#

in every plugin initialization. also no more:

"website_api_args['count'] = self.long_results_limit if long_search else self.results_limit"

in every search. instead we'd have:

"website_api_args['count'] = result_count"

from the user's view, it would allow to change the result count between searches (without restarting Cardapio if, of course, Cardapio's not caching the settings itself).

if you agree I could send a patch including a patch for each currently existing plugin.

Revision history for this message
Thiago Teixeira (tvst) wrote :

Approved :)

If you post a patch here I will incorporate it. Right now I'm just too busy to do it myself. (Next week I'll be back to my normal workload)

Revision history for this message
Paweł Bara (keirangtp) wrote :

could I maybe do it on my branch and then you'd merge it with the rest of my changes?

PS. I have only a few days more before going abroad so respond ASAP. ;)

Revision history for this message
Jan (jancborchardt-deactivatedaccount) wrote :

I’ll take the freedom of answering for Thiago:
Yes, of course you can. Either patch or branch is just great.
Thank you very much for your help and the great plugins! :)

Revision history for this message
Thiago Teixeira (tvst) wrote :

What he ^ said

:)

Revision history for this message
Paweł Bara (keirangtp) wrote :

It's in my branch but wait until I check the stuff again tomorrow.

Revision history for this message
Paweł Bara (keirangtp) wrote :

Done and ready. Unfortunately my editor is stubborn and has removed all the trailing spaces from cardapio.py. The diff is quite crowded but it seems that the important lines are: 1698, 1719, 3727 and the comment above the search() method in plugin API.

I could not test VirtualBox plugin (see bug 616541) but everything else seems to work fine.

The things that I've written and have not been merged yet (this bugfix, Amazon, eBay, Pidgin and some other stuff probably) will be my last contribution for now. I'm leaving and won't be back for a month. If you won't go anywhere and Cardapio's evolution will manage to hold it's pace, I'll gladly contribute much more then. ;) See ya'!

Revision history for this message
Thiago Teixeira (tvst) wrote :

Thanks for all the help Pawel. I will review and merge your latest code ASAP (which means probably tomorrow or Sunday).

Have fun wherever you're going :)

Thiago Teixeira (tvst)
Changed in cardapio:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.