CMFCalendar - search in portal_catalog failed after localisation of portal_types

Bug #161385 reported by Bug Importer
0
Affects Status Importance Assigned to Milestone
Zope CMF buildout
Invalid
Medium
Unassigned

Bug Description

To localize portal_types I update all 'Type' properties with the french translation. After that, the calendar don't find new events.

I trace the culprit and discover that in CalendarTool, the search on portal_catalog use the 'Type' property. I patch it to use the 'meta_type' property and update www/configureCalendarTool.zpt accordingly and all return to normal.

Maybe useful for further release...

Patch:

--- CalendarTool.py.orig Sun Feb 23 15:09:42 2003
+++ CalendarTool.py Sun Feb 23 14:54:55 2003
@@ -49,7 +49,7 @@
                                    __name__='manage_configure')

     def __init__(self):
- self.calendar_types = ['Event']
+ self.calendar_types = ['CMF Event']
         self.use_session = ""

     security.declareProtected( CMFCorePermissions.ManagePortal
@@ -129,7 +129,7 @@
         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,
+ query=self.portal_catalog(meta_type=self.calendar_types,
                                   review_state='published',
                                   start=(first_date, last_date),
                                   start_usage='range:min:max',
@@ -142,7 +142,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(meta_type=self.calendar_types,
                                    review_state='published',
                                    end=(first_date, last_date),
                                    end_usage='range:min:max',
@@ -208,19 +208,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(meta_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(meta_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(meta_type=self.calendar_types,
                                   review_state='published',
                                   start=first_date,
                                   start_usage='range:max',
--- www/configureCalendarTool.zpt.orig Sun Feb 23 15:10:26 2003
+++ www/configureCalendarTool.zpt Sun Feb 23 14:50:36 2003
@@ -9,17 +9,17 @@
  <h3>Portal Types to show in the calendar</h3>
  <select name="show_types:list" size="7" multiple>

- <tal:types tal:repeat="type here/portal_types/objectIds">
+ <tal:types tal:repeat="type here/portal_types/objectValues">

    <option value="#"
- tal:attributes="value type"
- tal:content="type"
- tal:condition="python: type not in here.getCalendarTypes()">type</option>
+ tal:attributes="value type/content_meta_type"
+ tal:content="type/content_meta_type"
+ tal:condition="python: type.getProperty('content_meta_type') not in here.getCalendarTypes()">type</option>

    <option value="#" selected
- tal:attributes="value type"
- tal:content="type"
- tal:condition="python: type in here.getCalendarTypes()">type</option>
+ tal:attributes="value type/content_meta_type"
+ tal:content="type/content_meta_type"
+ tal:condition="python: type.getProperty('content_meta_type') in here.getCalendarTypes()">type</option>

   </tal:types>

Revision history for this message
Florent Guillaume (efge) wrote :

Status: Pending => Rejected

This has already been fixed in CVS, see
http://cvs.zope.org/CMF/CMFCalendar/CalendarTool.py.diff?r1=1.5&r2=1.6

Furthermore, your fix was not correct: the correct way to do type
differentiation in CMF is to use portal_type, not meta_type.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.