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
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
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.
Cool, fame at last! :-)
Nice blog, by the way
Cheers, Jon
Ah, Jon is being unnecessarily modest. He has been exploring CMF for quite some time and has helped me out before.
Thanks Jon!