[Zope-CMF] CMFCalendar issue
Florent Guillaume
fg@nuxeo.com
Tue, 15 Oct 2002 23:35:20 +0000 (UTC)
Actually there are two fixes in that patch, the one for portal_type, and
one about last days of months from the CMF-1_3-branch that hadn't been
merged in HEAD (or vice versa, I don't remember).
Florent
Tres Seaver <tseaver@zope.com> wrote:
> -=-=-=-=-=-
>
> On Tue, 2002-10-15 at 15:53, Eric Dunn wrote:
> > I've created a ZOPE 2.5.1 site with CMF 1.3.
> > After deplyment to Production it was discovered that
> > CMF Events do not show in the presentation layer of
> > the Calendar on the last day of each month.
> > Example: Events posted in the CMF will show in the
> > CMFCalendar for everyday except the last day (31
> > Oct.).
> > Tried all obvious operations with no success
> > (security, publishing, ect...)
>
> Could it be related to caching? I just created an event on the dogbowl
> for 10/31/2002, and it is showing up:
>
> http://cmf.zope.org
>
> (You may need to force a cache refresh).
>
> > Anyone know if this is a known bug?
>
> I do know we fixed a bug after 1.3 where the wrong field was being
> used to filter the catalog ('Type' instead of 'portal_type'); could
> that be in play, here? I am attaching a patch you could try, if that
> is the case.
>
> Tres.
> --
> ===============================================================
> Tres Seaver tseaver@zope.com
> Zope Corporation "Zope Dealers" http://www.zope.com
>
> -=-=-=-=-=-
>
> Index: CMFCalendar/CalendarTool.py
> ===================================================================
> RCS file: /cvs-repository/CMF/CMFCalendar/CalendarTool.py,v
> retrieving revision 1.1.6.2
> retrieving revision 1.1.6.3
> diff -u -r1.1.6.2 -r1.1.6.3
> --- CMFCalendar/CalendarTool.py 2 Aug 2002 17:21:38 -0000 1.1.6.2
> +++ CMFCalendar/CalendarTool.py 6 Oct 2002 16:34:07 -0000 1.1.6.3
> @@ -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',
>
> -=-=-=-=-=-
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com