[Zope] CMF / Plone Question - SOLVED

Oliver Marx oliver@tekk.dk
Sun, 7 Jul 2002 23:34:36 +0200


This script solves the problem of getting a list of IDs of Plone Folders in
the current folder. Use only with Plone!

o=context.portal_url.getPortalObject()

if obj is None:
    obj=context

relative_ids = context.portal_url.getRelativeContentPath(obj)

id = relative_ids[:len(relative_ids)-1:]
o=o.restrictedTraverse(id)

return o.objectValues('Plone Folder')

\Oliver

>>-----Original Message-----
>>From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
>>Oliver Marx
>>Sent: 7. juli 2002 14:56
>>To: Robert Rottermann; Zope mailinglist
>>Subject: RE: [Zope] CMF / Plone Question
>>
>>
>>Neither here nor container does the work.
>>
>>I tested the code outside Plone and there both versions of the code works
>>perfectly.
>>
>>Ploners come to my rescue :)
>>
>>\Oliver
>>>>-----Original Message-----
>>>>From: Robert Rottermann [mailto:robert@redcor.ch]
>>>>Sent: 6. juli 2002 23:35
>>>>To: oliver@tekk.dk; Zope mailinglist
>>>>Subject: Re: [Zope] CMF / Plone Question
>>>>
>>>>
>>>>cointainer is the folder in which a script or template resides.
>>>>So it is allway the same.
>>>>What you need is here. This point to the object where you are.
>>>> <div tal:define="folders python:here.objectValues('Plone Folder')">
>>>>Robert
>>>>
>>>>----- Original Message -----
>>>>From: "Oliver Marx" <oliver@tekk.dk>
>>>>To: "Zope mailinglist" <zope@zope.org>
>>>>Sent: Saturday, July 06, 2002 9:39 PM
>>>>Subject: [Zope] CMF / Plone Question
>>>>
>>>>
>>>>> Hi
>>>>>
>>>>> I want to get all the Plone Folders in the current Plone Folder.
>>>>>
>>>>> After a cup of coffee I started out with:
>>>>>
>>>>> <div tal:define="folders python:container.objectValues('Plone
>>Folder')">
>>>>>
>>>>> But it seems that "container" in this case allways is the
>>portal root!?
>>>>>
>>>>> To clear things up:
>>>>>
>>>>> root
>>>>>  - Partners
>>>>>   - IBM
>>>>>   - Oracle
>>>>>   - HP
>>>>>
>>>>>  - Resellers
>>>>>   - Info-IT
>>>>>   - ComputerCity
>>>>>   - Just Hardware
>>>>>
>>>>> When I am in root I want to get (Partners, Resellers).
>>>>> When I am in Partners I want to get (IBM, Oracle, HP).
>>>>> When I am in Resellers I want to get (Info-IT, ComputerCity, Just
>>>>Hardware)
>>>>>
>>>>> http://mysite/ gives me (Partners,Resellers)
>>>>>
>>>>> http://mysite/Partners still gives me (Partners, Resellers)
>>>>>
>>>>> Which obviously isn't what I want.
>>>>>
>>>>> What am I missing?
>>>>>
>>>>> Maybe I should say the the script is called from a customized
>>>>> main_left_column.
>>>>>
>>>>> \Oliver
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---
>>>>> Outgoing mail is certified Virus Free.
>>>>> Checked by AVG anti-virus system (http://www.grisoft.com).
>>>>> Version: 6.0.371 / Virus Database: 206 - Release Date: 13-06-2002
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Zope maillist  -  Zope@zope.org
>>>>> http://lists.zope.org/mailman/listinfo/zope
>>>>> **   No cross posts or HTML encoding!  **
>>>>> (Related lists -
>>>>>  http://lists.zope.org/mailman/listinfo/zope-announce
>>>>>  http://lists.zope.org/mailman/listinfo/zope-dev )
>>>>>
>>>>
>>>>---
>>>>Incoming mail is certified Virus Free.
>>>>Checked by AVG anti-virus system (http://www.grisoft.com).
>>>>Version: 6.0.371 / Virus Database: 206 - Release Date: 13-06-2002
>>>>
>>---
>>Outgoing mail is certified Virus Free.
>>Checked by AVG anti-virus system (http://www.grisoft.com).
>>Version: 6.0.371 / Virus Database: 206 - Release Date: 13-06-2002
>>
>>
>>
>>_______________________________________________
>>Zope maillist  -  Zope@zope.org
>>http://lists.zope.org/mailman/listinfo/zope
>>**   No cross posts or HTML encoding!  **
>>(Related lists -
>> http://lists.zope.org/mailman/listinfo/zope-announce
>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>---
>>Incoming mail is certified Virus Free.
>>Checked by AVG anti-virus system (http://www.grisoft.com).
>>Version: 6.0.371 / Virus Database: 206 - Release Date: 13-06-2002
>>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.371 / Virus Database: 206 - Release Date: 13-06-2002