[Zope] Caledar Tag

Martijn Pieters mj@antraciet.nl
Fri, 10 Sep 1999 21:38:41 +0200


At 14:39 10-9-99 , Jason Spisak wrote:
>The a top snip of the code I ended up with is:
>
><!--#var standard_html_header-->
><center>
><!--#with
>"_(recruiter_stuff=Catalog(recruiter=AUTHENTICATED_USER.getUserName(),
>meta_type=['Interview','Deal','Appointment','Call']))"-->
><!--#calendar mode=month-->
>        <a href="<!--#var "linkDate(date)"-->">
>          <!--#in recruiter_stuff-->
>            <!--#if "calendar_date.dayOfYear()==date.dayOfYear()"-->
>             <font color="FF0000">
>            <!--#/if-->
>          <!--#/in-->
>        <!--#var date fmt=dd--></a>
>        </font>
><!--#/with-->
><!--#var standard_html_footer-->

So you ask the Catalog for all items for a given user and then loop through 
all these items for every day displayed by the calender?

Why not, depending on what would be speediest:

1. Call the Catalog for every day displayed and ask the it for items on 
that day.
or
2. Call the Catalog once the first time the code in the calender tag is 
rendered (test for day one?), ask for the data for the current month, and 
store it in a REQUEST variable. Then loop through this limited set.

In the last case, you could even make a temporary dictionary keyed on day 
of the month. This is quite simple.

You should try and find a balance between number of loops and number of 
calls to the Catalog.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------