[Zope-CMF] Problems with Objects or Acquisition
Jeffrey P Shell
jeffrey@cuemedia.com
Wed, 12 Dec 2001 12:38:39 -0700
A catalog query doesn't return the found objects themselves - it
returns Result objects. Data on the result objects is defined in
the catalog - it's essentially cached at the time the object is
indexed/reindexed.
Result objects do, however, let you get to the target object
directly through the getObject method. For example:
DTML:
<dtml-in expr="portal_catalog(...)">
Title: <dtml-var Title> <!-- returned in the result object -->
<dtml-with getObject>
<dtml-var someNonCatalogedValue>
<dtml-var someOtherNonCatalogedValue>
</dtml-with>
</dtml-in>
PageTemplates:
<div tal:repeat="result python:here.portal_catalog(...)">
Title: <span tal:replace="result/Title">Title from result object</span>
<span tal:define="target result/getObject">
<span tal:replace="target/someNonCatalogedValue>not cataloged</span>
</span>
</div>
On Wednesday, December 12, 2001, at 12:15 PM, Byl Walker wrote:
> Hi all -
>
> I'll try to distill my problem to be as succinct as possible.
>
> I am new to Zope and CMF and Python, so many of the things that I've
> been doing with my new site have been learn-as-you-go process. Thus
> far, I've created new FTI-based portals, and have had no problem with
> getting data in or out on the pages defined for views and edits, but
> need to be able to display variables from the portals on pages that are
> not defined in the factory definition.
>
> I am using the portal_catalog.searchResults method to return results,
> but don't know how to access the variables that aren't in the Dublin
> core. Is there some way of doing this in a dtml doc or method?
> Or do I
> need to write another method for my FTI to retrieve the info?
>
> I've been through the list archives and have found nothing at all
> relating to my questions. Or maybe I simply don't understand enough
> about what I'm looking for.
>
> Any help would be muchly appreciated. If anyone thinks they could
> help,
> but needs to see the code I'm using to access the data, I will be happy
> to share it.
>
Jeffrey P Shell, jeffrey@cuemedia.com