[Zope] folders recursively

Srinath Mantripragada srinath.man@cpm.com.br
Thu, 29 Mar 2001 14:39:27 -0300


try this ExternalMethod..


def recurseZopeFolder(zopeObject):
        """ get all urls of subObjects from the givem object (used with
getAllSubObjectUrls)"""
        urls =3D []
        for obj in zopeObject.objectIds():
        #       if not re.compile("^_.*$").match(obj) !=3D None :
                        a =3D zopeObject._getOb(obj)
                        if a.isPrincipiaFolderish:
                                urls =3D urls + recurseZopeFolder(a)
                        else:
                                 newUrl =3D ''
                                 for b in a.getPhysicalPath():
                                        newUrl =3D  newUrl + '/' + b
                                 urls.append(newUrl)
        newUrl =3D ''
        for b in zopeObject.getPhysicalPath():
                newUrl =3D  newUrl + '/' + b
        urls.append(newUrl)
        return urls



--
Srinath Mantripragada
srinath.man@cpm.com.br

--
Srinath Mantripragada
srinath.man@cpm.com.br

> -----Original Message-----
> From: Bill Anderson [mailto:bill@libc.org]
> Sent: quinta-feira, 29 de mar=E7o de 2001 17:32
> To: zope@zope.org
> Subject: Re: [Zope] folders recursively
>=20
>=20
> On 29 Mar 2001 16:10:22 +0200, Petr Knapek wrote:
> > Hi Zopists,
> >=20
> > I would like to call some DTML method on all Folders in my ZODB.  I
> > think the best way should be recursion but I do not know how to do
> > it in DTML.
>=20
>=20
> Don't do it with DTML use a Python Method/Script.
>=20
> Bill
>=20
>=20
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>=20