get object contents in portal_catalog search

classic Classic list List threaded Threaded
2 messages Options
katinka van der Kooij katinka van der Kooij
Reply | Threaded
Open this post in threaded view
|

get object contents in portal_catalog search



Hi,

I use Plone 2

And want to make a portal catalog search for a folderish archetype where the search includes a check wether the folderish archetype object contains any objects.

I tried te following:

    <div tal:define="results
           python:here.portal_catalog(
                                    portal_type='vraag', 
                                    );">

<span tal:content="obj/Title">

 With the check for object contents is:

 <span tal:content="python:obj.contentValues()">Antwoord</span>

However, this returns the contentValues of the entire plone site, while obj/Title returns te title of the search result. Should I use something different from obj or define obj?

Any insights on this problem are greatly appreciated!

Katinka

 

 

------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users
J Cameron Cooper-3 J Cameron Cooper-3
Reply | Threaded
Open this post in threaded view
|

Re: get object contents in portal_catalog search

katinka van der Kooij wrote:

>
>
> Hi,
>
> I use Plone 2
>
> And want to make a portal catalog search for a folderish archetype where
> the search includes a check wether the folderish archetype object
> contains any objects.
>
> I tried te following:
>
>     <div tal:define="results
>            python:here.portal_catalog(
>                                     portal_type='vraag',
>                                     );">
>
> <span tal:content="obj/Title">
>
>  With the check for object contents is:
>
>  <span tal:content="python:obj.contentValues()">Antwoord</span>
>
> However, this returns the contentValues of the entire plone site, while
> obj/Title returns te title of the search result. Should I use something
> different from obj or define obj?
>
> Any insights on this problem are greatly appreciated!

You don't show where 'obj' comes from, but I'll assume it's the repeat
variable over 'results'.

Catalog results are not objects themselves (since that would be very
expensive, and catalogs are about efficiency) but "Brains". You may ask
them for an attribute of any metadata stored in the catalog, but they
have no methods or any attributes not stored in metadata. So when you
ask for 'contentValues' you acquire it (possibly from the portal_catalog
tool.)

If you want the object itself, you must follow the brains API, and ask
it for 'getObject'.

                --jcc
--
"Building Websites with Plone"
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.com


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users