Back to index

plone3  3.1.7
rssAllowed.py
Go to the documentation of this file.
00001 ## Script (Python) "rssAllowed"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=site=False
00008 ##title=RSS Allowed
00009 
00010 # this is a replacement for the old syndication allowed option
00011 # in this case we don't bother getting syndication on each folder
00012 # we just check globally
00013 from Products.CMFCore.utils import getToolByName
00014 
00015 ps = getToolByName(context, "portal_syndication")
00016 
00017 allowed = True
00018 if not site and not ps.isSyndicationAllowed(context):
00019     allowed = False
00020 if site and not ps.isSiteSyndicationAllowed():
00021     allowed = False
00022 # really we should be raising an HTTP error, something that
00023 # rss news readers would understand
00024 if not allowed:
00025     raise ValueError, "Site syndication via RSS feeds is not allowed. Ask the sites"\
00026     " system administrator to go to portal_syndication > Policies and enable syndication. Each folder"\
00027     " then needs to have syndication enabled."
00028