diff --git a/splinext/pokedex/helpers.py b/splinext/pokedex/helpers.py index 2f9fbd35..fe35cc6a 100644 --- a/splinext/pokedex/helpers.py +++ b/splinext/pokedex/helpers.py @@ -622,7 +622,10 @@ def scale_sizes(size_dict, dimensions=1): return scaled_sizes -def apply_pokemon_template(template, pokemon, _=_): +def _no_icon(pokemon): + return u"" + +def apply_pokemon_template(template, pokemon, get_icon=_no_icon, _=_): u"""`template` should be a string.Template object. Uses safe_substitute to inject some fields from the Pokémon into the @@ -633,7 +636,7 @@ def apply_pokemon_template(template, pokemon, _=_): """ d = dict( - icon=pokemon_form_image(pokemon.default_form, prefix=u'icons'), + icon=get_icon(pokemon), id=pokemon.species.id, name=pokemon.default_form.name, diff --git a/splinext/pokedex/templates/pokedex/search/pokemon.mako b/splinext/pokedex/templates/pokedex/search/pokemon.mako index 4910e3cc..37593d26 100644 --- a/splinext/pokedex/templates/pokedex/search/pokemon.mako +++ b/splinext/pokedex/templates/pokedex/search/pokemon.mako @@ -17,6 +17,12 @@
%def> +<% +# Callback for apply_pokemon_template +def get_icon(pokemon): + return dexlib.pokemon_form_image(pokemon.default_form, prefix=u'icons') +%> + ### RESULTS ### ## Four possibilities here: the form wasn't submitted, the form was submitted ## but was bogus, the form was submitted and there are no results, or the form @@ -132,7 +138,7 @@ ${getattr(self, 'col_' + column)()} ## Plain bulleted list with a Template.${pattern}