CMF: Fields not available in objects found by catalog search?
Greetings. I'm constructing a "schedule" page in Plone, following closely the example of the news page and events slot. It lists information about Events (CMF Event type) that meet specified criteria (keyword, start date within a specified range, etc.) by calling container.portal_catalog(). So far, so good. I can then iterate over the returned result set, call getObject on each element, and access fields of the object such as "Title" and "Description". However, not all of the Event type's fields seem to be available. If I try to access "location" or "contact_name" (or "Location" or "ContactName"), I get a KeyError. No such field. What gives? Why are some fields not accessible? And where can I hack something to make them accessible? Thanks, ..Ian Beatty -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Ian Beatty webmaster@amcberkshire.org Webmaster home: 413.253.7439 Berkshire Chapter work: 413.545.9483 Appalachian Mountain Club http://amcberkshire.org/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- --
Ian Beatty wrote at 2003-9-17 20:32 -0400:
... However, not all of the Event type's fields seem to be available. If I try to access "location" or "contact_name" (or "Location" or "ContactName"), I get a KeyError. No such field.
What gives? Why are some fields not accessible? And where can I hack something to make them accessible?
Are you sure, you try to access them on the "getObject()" result. This is your true object, it should have the attributes (if it is of the expected type). The basic search hit (the catalog search returns a sequence of them), on the other hand, only has attributes corresponding to the "Metadata" defined for the catalog. See the "Metadata" tab of "portal_catalog". Dieter
participants (2)
-
Dieter Maurer -
Ian Beatty