Chapter 9.3.1. Laying the Groundwork for Our Project Page

The first thing you should see in the project.kid file is a <?python> tag:

<?python
         from whatwhat.model import STATUS_BEHIND_SCHEDULE
         from whatwhat.utils import textilize

         def get_display_notes(project, show_all_notes):
                 if show_all_notes:
                         return project.notes
                 return project.recent_notes
?>

This should look familiar to you. The project.kid template starts out with a quick bit of Python that imports the textilize function (which we explored in Chapter 8, “RSS, Cookies, and Dynamic Views in WhatWhat Status”), and the behind-schedule status identifier. The get_display_notes function is new, but it should be pretty easy to see what it does. If the show_all_notes value is true, it returns ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.