[Zope-dev] DateTime objects's and ZCatalog

Jason Spisak 444@hiretechs.com
Tue, 23 May 2000 12:36:12 -0400


Shane,

Actually, one big thing I did notice is that when I run the DTML that
calls the ZCatalog search for the external method that is stored in a
Field index called 'calendar_day', I get an instance of
DateTime.DateTime.DateTime for ALL of the instances that use that
external method.  Shouldn't they already be in the index?  Why does it
need to instanciate those?

external method:

def calendar_day(self)
    return int(self.calendar_date)/100000

Here's the DTML method:

<dtml-var standard_html_header>
<dtml-var staff_header><br>
<center>
<dtml-calendar mode=month>
 <dtml-if "mode=='month'">
   <a href="<dtml-var "linkDate(date)">">
     <dtml-if "_.len(Catalog(recruiter=AUTHENTICATED_USER.getUserName(),
meta_types=['Interview', 'Call', 'Appointment', 'Deal'],
calendar_day=_.int(date)/100000))">
       <font color="FF0000">
     </dtml-if>
     <dtml-var date fmt=dd></a>
     </font>
 <dtml-elif "mode=='day'">
  <font size="+3"><b>
  <dtml-var date fmt=dd>
</b></font>
<dtml-in "Catalog(recruiter=AUTHENTICATED_USER.getUserName(),
meta_types=['Interview', 'Call', 'Appointment', 'Deal'],
calendar_day=_.int(date)/100000)">
<p><dtml-if "meta_type=='Call'"><dtml-with
"resolve_url(getpath(data_record_id_), REQUEST)"><dtml-with
aq_parent><dtml-if "meta_type=='Contact'"><dtml-with aq_parent><a
href="<dtml-var BASE0>/<dtml-var url>?frame=</dtml-with><dtml-var
id><dtml-else><a href="<dtml-var BASE0>/<dtml-var
url></dtml-if></dtml-with>" target="_parent"></dtml-with><dtml-else><a
href="<dtml-var BASE0>/<dtml-var
"Catalog.getpath(data_record_id_)">"></dtml-if><font
color="FF0000"><dtml-var calendar_date fmt=AMPMMinutes> : <dtml-var
meta_type></font></a>
</dtml-in>
<form action="manage_addProduct/Staff/AppointmentClass_factory"
method="post">
<center>
<table>
<tr>
<td>
<i>An Appointment is something other than an Interview or Offer,
<br>or anything else in the system related to recruiting.
<br>To create the appointment click "New Appoinment"
<br></i>
<input type="hidden" name="appointment_day" value="<dtml-var date
fmt=Date>">
<input value="New Appointment" type="submit">
</td>
</tr>
</table>
<center>
</form>
<dtml-elif "mode=='week'">
<a href="<dtml-var "linkDate(date)">">
<dtml-if "_.len(Catalog(recruiter=AUTHENTICATED_USER.getUserName(),
meta_types=['Interview', 'Call', 'Appointment', 'Deal'],
calendar_day=_.int(date)/100000))">
<font color="FF0000">
</dtml-if>
<dtml-var date fmt=dd></a>
</font>
<dtml-in "Catalog(recruiter=AUTHENTICATED_USER.getUserName(),
meta_types=['Interview', 'Call', 'Appointment', 'Deal'],
calendar_day=_.int(date)/100000)">
<p><a href="<dtml-var BASE0>/<dtml-var
"Catalog.getpath(data_record_id_)">"><font color="FF0000"><dtml-var
meta_type></font></a>
</dtml-in>
</dtml-if>
</dtml-calendar>
</center>
<br>
<dtml-var staff_header>
<dtml-var standard_html_footer>


Is the call to compare the calendar_day to the _.int(date)/100000
creating a DateTime object for every comparison?

All my best,
-- 
Jason Spisak
444@hiretechs.com