Michael Steinfeld wrote:
> here is my code that I am converting, Hopefully you can offer another 
> suggestion
> 
>          for days in self.getMonthCal ():
>                 for day in days:
>                     if day == 0:
>                         print '<td bgcolor=eeeeee></td>'
>                     else:
>                         print '<td  bgcolor=#29558D align=middle>'
>                         print '<a class=links 
> href=day.py?day='+str(day)+'>'+str(day)+'</a>'
>                         print '</td>'
> 

Again, make two steps. First preprocess the data:

<?python data = [day == 0
     and ('#eeeeee', None, None) or ('#29558d', 'middle', day)
     for days in monthcal for day in days] ?>

Then display the data:

<td py:for="c, a, d in data" bgcolor="$c" align="$a">
<a py:if="d" class="links" href="day.py?day=$d">$d</a></td>

This division simplifies a lot. You can also run the preprocessing 
outside the Kid template where it is easier to debug.

-- Christoph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to