Related Entries

Interview with Ploners
Formulator makes life easy
Server side python
Resetting Zope's session timeout
Getting undo history

« What is wrong with ZClasses?
» Steffi wins case against MS

Finding all syndication enabled folders in CMF

Here's a small Python script I wrote to return a list of folders that have syndication enabled in a CMF...

Here’s a small Python script I wrote to return a list of folders that have syndication enabled in a CMF site.

## Script (Python) "find_syndicated_folders"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Return a list of folder objects that’ve syndication enabled
##
results = []
for r in context.portal_catalog({'Type':['Folder']}):
    o = r.getObject()
    if 1==context.portal_syndication.isSyndicationAllowed(o):
        results.append(o)
return results
  1. Jon Edwards adds via Zope-CMF mailing list:
    "If your Folders are already cataloged, it might be worth adding 'isSyndicationAllowed' to the catalog metadata, otherwise you're doing a getObject on every Folder in your site, which is pretty expensive?"

    He is right. isSyndicationAllowed is a function, so I'm not sure that can be added to the catalog meta_data. But the proper and faster way to add the syndication property - whatever it is - to the catalog index and search for this property.

    Posted by: Babu on May 29, 2002 06:00 AM
  2. Cool, fame at last! :-)

    Nice blog, by the way

    Cheers, Jon

    Posted by: Jon Edwards on June 1, 2002 06:50 AM
  3. Ah, Jon is being unnecessarily modest. He has been exploring CMF for quite some time and has helped me out before.

    Thanks Jon!

    Posted by: Babu on June 1, 2002 03:35 PM
//-->