data.mak 928B

12345678910111213141516171819202122232425262728
  1. <%inherit file="local:templates.master"/>
  2. <%def name="title()">
  3. Welcome to TurboGears 2.3, standing on the shoulders of giants, since 2007
  4. </%def>
  5. <h2>Content Type Dispatch</h2>
  6. <p>
  7. This page shows how you can provide multiple pages
  8. directly from the same controller method. This page is generated
  9. from the expose decorator with the template defintion provided.
  10. You can provide a url with parameters and this page will display
  11. the parameters as html, and the json version will express
  12. the entries as JSON. Here, try it out: <a href="/data.html?a=1&b=2">/data.html?a=1&b=2</a>
  13. </p>
  14. <p>Click here for the <a href="${tg.url('/data.json', params=params)}">JSON Version of this page.</a></p>
  15. <p>The data provided in the template call is:
  16. <table>
  17. %for key, value in params.items():
  18. <tr>
  19. <td>${key}</td>
  20. <td>${value}</td>
  21. </tr>
  22. %endfor
  23. </table>