
How to create a controller method in Turbogears that can be called from within the controller, or rendered with a template
By: a guest on
Feb 26th, 2012 | syntax:
None | size: 0.54 KB | hits: 20 | expires: Never
@expose("json")
def artists(self, action="view",artist_id=None):
artists=session.query(model.Artist).all()
return dict(artists=artists)
artists = self.artists()
# The _artists method can be used from any other method
def _artists(self, action, artist_id):
artists = session.query(model.Artist).all()
return dict(artists=artists)
@expose("json")
#@identity.require(identity.non_anonymous())
# error handlers, etc.
def artists(self, action="view", artist_id=None):
return self._artists(action=action, artist_id=artist_id)