[CMF-checkins] CVS: CMF/CMFCalendar - CalendarTool.py:1.1.6.3

Florent Guillaume fg@nuxeo.com
Sun, 6 Oct 2002 12:34:08 -0400


Update of /cvs-repository/CMF/CMFCalendar
In directory cvs.zope.org:/tmp/cvs-serv4956/CMFCalendar

Modified Files:
      Tag: CMF-1_3-branch
	CalendarTool.py 
Log Message:
Merge from HEAD:

- Fixed CalendarTool to use portal_type and not Type to search for
  events in the catalog (Collector #28).

- Fixing a bug in CalendarTool where events were not showing on the
  last day of the month (fixed some time ago, had not been backported).



=== CMF/CMFCalendar/CalendarTool.py 1.1.6.2 => 1.1.6.3 ===
--- CMF/CMFCalendar/CalendarTool.py:1.1.6.2	Fri Aug  2 13:21:38 2002
+++ CMF/CMFCalendar/CalendarTool.py	Sun Oct  6 12:34:07 2002
@@ -127,9 +127,12 @@
         """ given a year and month return a list of days that have events """
         first_date=DateTime(str(month)+'/1/'+str(year))
         last_day=calendar.monthrange(year, month)[1]
-        last_date=DateTime(str(month)+'/'+str(last_day)+'/'+str(year))
-    
-        query=self.portal_catalog(Type=self.calendar_types,
+        ## This line was cropping the last day of the month out of the
+        ## calendar when doing the query
+	## last_date=DateTime(str(month)+'/'+str(last_day)+'/'+str(year))
+	last_date=first_date + last_day    
+        
+	query=self.portal_catalog(portal_type=self.calendar_types,
                                   review_state='published',	                          
                                   start=(first_date, last_date),
                                   start_usage='range:min:max',
@@ -142,7 +145,7 @@
         # but I don't know how to do that in one search query :(  - AD
 
         # if you look at calendar_slot you can see how to do this in 1 query - runyaga
-        query+=self.portal_catalog(Type=self.calendar_types,
+        query+=self.portal_catalog(portal_type=self.calendar_types,
                                    review_state='published',
                                    end=(first_date, last_date),
                                    end_usage='range:min:max',
@@ -208,19 +211,19 @@
         #last_date=DateTime(thisDay.Date()+" 23:59:59")
 
         # Get all events that Start on this day
-        query=self.portal_catalog(Type=self.calendar_types,
+        query=self.portal_catalog(portal_type=self.calendar_types,
                                   review_state='published',	                          
                                   start=(first_date,last_date),
                                   start_usage='range:min:max')
         
         # Get all events that End on this day
-        query+=self.portal_catalog(Type=self.calendar_types,
+        query+=self.portal_catalog(portal_type=self.calendar_types,
                                   review_state='published',	                          
                                   end=(first_date,last_date),
                                   end_usage='range:min:max')
 
         # Get all events that Start before this day AND End after this day
-        query+=self.portal_catalog(Type=self.calendar_types,
+        query+=self.portal_catalog(portal_type=self.calendar_types,
                                   review_state='published',
                                   start=first_date,
                                   start_usage='range:max',