If you have a controller method like so:
@expose('example.templates.example.index')
def index(self, *args, **kw):
fruits=session.query(model.Fruit).all()
# some code working on fruits
return dict(fruits=fruits)
How can I duplicate the method for the same html rendering but with filtered objects like example
@expose('example.templates.example.index')
def filtered(self, name="apple", *args, **kw):
fruits=session.query(model.Fruit).filter_by(name=name).all()
# some code working on fruits (same as in index)
# how to not duplicate the code but duplicate method with different input fruits?
return dict(fruits=fruits)
how to not duplicate the code but duplicate only method with different input fruits? I wish to have separate endpoints working the same but with filtered input.