title: How to create a controller method in Turbogears that can be called from within the controller, or rendered with a template
body: <p>If you have a controller method like so:</p>
  
  <pre><code>@expose("json")
  def artists(self, action="view",artist_id=None):
      artists=session.query(model.Artist).all()
      return dict(artists=artists)
  </code></pre>
  
  <p>How can you call that method from within your controller class, and get the python dict back - rather than the json-encoded string of the dict (which requires you to decode it from json back into a python dict). Is it really necessary to write one function to get the data out of your model, and another to pack that data for use by the templates (KID, JSON)? Why is it that when you call this method from in the same class, e.g.:</p>
  
  <pre><code>artists = self.artists()
  </code></pre>
  
  <p>You get a json string, when that's only appropriate if the method is called as part of a HTML request.
  What have I missed?</p>