Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
CMFDefault.SyndicationTool.SyndicationTool Class Reference
Inheritance diagram for CMFDefault.SyndicationTool.SyndicationTool:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.SyndicationTool.SyndicationTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def editProperties
def editSyInformationProperties
def enableSyndication
def disableSyndication
def getSyndicatableContent
def buildUpdatePeriods
def isSiteSyndicationAllowed
def isSyndicationAllowed
def getUpdatePeriod
def getUpdateFrequency
def getUpdateBase
def getHTML4UpdateBase
def getMaxItems

Public Attributes

 isAllowed
 syUpdatePeriod
 syUpdateFrequency
 syUpdateBase
 max_items

Static Public Attributes

string id = 'portal_syndication'
string meta_type = 'Default Syndication Tool'
tuple security = ClassSecurityInfo()
int isAllowed = 0
string syUpdatePeriod = 'daily'
int syUpdateFrequency = 1
tuple syUpdateBase = DateTime()
int max_items = 15
tuple manage_options
tuple overview = HTMLFile('synOverview', _dtmldir)
tuple propertiesForm = HTMLFile('synProps', _dtmldir)
tuple policiesForm = HTMLFile('synPolicies', _dtmldir)
tuple reportForm = HTMLFile('synReports', _dtmldir)

Static Private Attributes

 __implements__ = SimpleItem.__implements__

Detailed Description

    The syndication tool manages the site-wide policy for
    syndication of folder content as RSS.

Definition at line 41 of file SyndicationTool.py.


Member Function Documentation

Return a list of possible update periods for the xmlns: sy

Definition at line 244 of file SyndicationTool.py.

00244 
00245     def buildUpdatePeriods(self):
00246         """
00247         Return a list of possible update periods for the xmlns: sy
00248         """
00249         updatePeriods = ( ('hourly',  'Hourly')
00250                         , ('daily',   'Daily')
00251                         , ('weekly',  'Weekly')
00252                         , ('monthly', 'Monthly')
00253                         , ('yearly',  'Yearly')
00254                         )
00255         return updatePeriods

Disable syndication for the obj; and remove it.

Definition at line 220 of file SyndicationTool.py.

00220 
00221     def disableSyndication(self, obj):
00222         """
00223         Disable syndication for the obj; and remove it.
00224         """
00225         syInfo = getattr(obj, 'syndication_information', None)
00226 
00227         if syInfo is None:
00228             raise 'This object does not have Syndication Information'
00229 
00230         obj._delObject('syndication_information')

def CMFDefault.SyndicationTool.SyndicationTool.editProperties (   self,
  updatePeriod = None,
  updateFrequency = None,
  updateBase = None,
  isAllowed = None,
  max_items = None,
  REQUEST = None 
)
Edit the properties for the SystemWide defaults on the
SyndicationTool.

Definition at line 107 of file SyndicationTool.py.

00107 
00108                       ):
00109         """
00110         Edit the properties for the SystemWide defaults on the
00111         SyndicationTool.
00112         """
00113         if isAllowed is not None:
00114             self.isAllowed = isAllowed
00115 
00116         if updatePeriod is not None:
00117             self.syUpdatePeriod = updatePeriod
00118         else:
00119             try:
00120                 del self.syUpdatePeriod
00121             except (AttributeError, KeyError):
00122                 pass
00123 
00124         if updateFrequency is not None:
00125             self.syUpdateFrequency = int(updateFrequency)
00126         else:
00127             try:
00128                 del self.syUpdateFrequency
00129             except (AttributeError, KeyError):
00130                 pass
00131 
00132         if updateBase is not None:
00133             if type( updateBase ) is type( '' ):
00134                 updateBase = DateTime( updateBase )
00135             self.syUpdateBase = updateBase
00136         else:
00137             try:
00138                 del self.syUpdateBase
00139             except (AttributeError, KeyError):
00140                 pass
00141 
00142         if max_items is not None:
00143             self.max_items = int(max_items)
00144         else:
00145             try:
00146                 del self.max_items
00147             except (AttributeError, KeyError):
00148                 pass
00149 
00150         if REQUEST is not None:
00151             REQUEST['RESPONSE'].redirect( self.absolute_url()
00152                                         + '/propertiesForm'
00153                                         + '?manage_tabs_message=Tool+Updated.'
00154                                         )

def CMFDefault.SyndicationTool.SyndicationTool.editSyInformationProperties (   self,
  obj,
  updatePeriod = None,
  updateFrequency = None,
  updateBase = None,
  max_items = None,
  REQUEST = None 
)
Edit syndication properties for the obj being passed in.
These are held on the syndication_information object.
Not Sitewide Properties.

Definition at line 163 of file SyndicationTool.py.

00163 
00164                                    ):
00165         """
00166         Edit syndication properties for the obj being passed in.
00167         These are held on the syndication_information object.
00168         Not Sitewide Properties.
00169         """
00170         if not _checkPermission( ManageProperties, obj ):
00171             raise AccessControl_Unauthorized
00172 
00173         syInfo = getattr(obj, 'syndication_information', None)
00174 
00175         if syInfo is None:
00176             raise 'Syndication is Disabled'
00177 
00178         if updatePeriod is not None:
00179             syInfo.syUpdatePeriod = updatePeriod
00180         else:
00181             syInfo.syUpdatePeriod = self.syUpdatePeriod
00182 
00183         if updateFrequency is not None:
00184             syInfo.syUpdateFrequency = int(updateFrequency)
00185         else:
00186             syInfo.syUpdateFrequency = self.syUpdateFrequency
00187 
00188         if updateBase is not None:
00189             if type( updateBase ) is type( '' ):
00190                 updateBase = DateTime( updateBase )
00191             syInfo.syUpdateBase = updateBase
00192         else:
00193             syInfo.syUpdateBase = self.syUpdateBase
00194 
00195         if max_items is not None:
00196             syInfo.max_items = int(max_items)
00197         else:
00198             syInfo.max_items = self.max_items

Here is the call graph for this function:

Enable syndication for the obj

Definition at line 200 of file SyndicationTool.py.

00200 
00201     def enableSyndication(self, obj):
00202         """
00203         Enable syndication for the obj
00204         """
00205         if not self.isSiteSyndicationAllowed():
00206             raise 'Syndication is Disabled'
00207 
00208         if hasattr(aq_base(obj), 'syndication_information'):
00209             raise 'Syndication Information Exists'
00210 
00211         syInfo = SyndicationInformation()
00212         obj._setObject('syndication_information', syInfo)
00213         syInfo = obj._getOb('syndication_information')
00214         syInfo.syUpdatePeriod = self.syUpdatePeriod
00215         syInfo.syUpdateFrequency = self.syUpdateFrequency
00216         syInfo.syUpdateBase = self.syUpdateBase
00217         syInfo.max_items = self.max_items
00218         syInfo.description = "Channel Description"

Here is the call graph for this function:

Return HTML4 formated UpdateBase DateTime

Definition at line 353 of file SyndicationTool.py.

00353 
00354     def getHTML4UpdateBase(self, obj=None):
00355         """
00356         Return HTML4 formated UpdateBase DateTime
00357         """
00358         if not self.isSiteSyndicationAllowed():
00359             raise 'Syndication is not Allowed'
00360 
00361         if obj is None:
00362             when = self.syUpdateBase
00363             return when.HTML4()
00364 
00365         syInfo = getattr(obj, 'syndication_information',
00366                             None)
00367         if syInfo is not None:
00368             when = syInfo.syUpdateBase
00369             return when.HTML4()
00370         else:
00371             return 'Syndication is not Allowed'

Here is the call graph for this function:

Return the max_items to be displayed in the syndication

Definition at line 372 of file SyndicationTool.py.

00372 
00373     def getMaxItems(self, obj=None):
00374         """
00375         Return the max_items to be displayed in the syndication
00376         """
00377         if not self.isSiteSyndicationAllowed():
00378             raise 'Syndication is not Allowed'
00379 
00380         if obj is None:
00381             return self.max_items
00382 
00383         syInfo = getattr(obj, 'syndication_information',
00384                             None)
00385         if syInfo is not None:
00386             return syInfo.max_items
00387         else:
00388             return 'Syndication is not Allowed'
00389 
00390 InitializeClass(SyndicationTool)
00391 registerToolInterface('portal_syndication', ISyndicationTool)

Here is the call graph for this function:

An interface for allowing folderish items to implement an
equivalent of PortalFolderBase.contentValues()

Definition at line 232 of file SyndicationTool.py.

00232 
00233     def getSyndicatableContent(self, obj):
00234         """
00235         An interface for allowing folderish items to implement an
00236         equivalent of PortalFolderBase.contentValues()
00237         """
00238         if hasattr(obj, 'synContentValues'):
00239             values = obj.synContentValues()
00240         else:
00241             values = PortalFolderBase.contentValues(obj)
00242         return values

Return the base date to be used with the update frequency
and the update period to calculate a publishing schedule.

Note:  I'm not sure what's best here, creation date, last
modified date (of the folder being syndicated) or some
arbitrary date.  For now, I'm going to build a updateBase
time from zopetime and reformat it to meet the W3CDTF.
Additionally, sitewide policy checks might have a place
here...

Definition at line 325 of file SyndicationTool.py.

00325 
00326     def getUpdateBase(self, obj=None):
00327         """
00328         Return the base date to be used with the update frequency
00329         and the update period to calculate a publishing schedule.
00330 
00331         Note:  I'm not sure what's best here, creation date, last
00332         modified date (of the folder being syndicated) or some
00333         arbitrary date.  For now, I'm going to build a updateBase
00334         time from zopetime and reformat it to meet the W3CDTF.
00335         Additionally, sitewide policy checks might have a place
00336         here...
00337         """
00338         if not self.isSiteSyndicationAllowed():
00339             raise 'Syndication is not Allowed'
00340 
00341         if obj is None:
00342             when = self.syUpdateBase
00343             return when.ISO()
00344 
00345         syInfo = getattr(obj, 'syndication_information',
00346                             None)
00347         if syInfo is not None:
00348                 when = syInfo.syUpdateBase
00349                 return when.ISO()
00350         else:
00351             return 'Syndication is not Allowed'

Here is the call graph for this function:

Return the update frequency (as a positive integer) for
the syn namespace.  This is either on the object being
pass or the portal_syndication tool (if a sitewide value
or default is set).

Note:  Need to add checks for sitewide policies!!!

Definition at line 302 of file SyndicationTool.py.

00302 
00303     def getUpdateFrequency(self, obj=None):
00304         """
00305         Return the update frequency (as a positive integer) for
00306         the syn namespace.  This is either on the object being
00307         pass or the portal_syndication tool (if a sitewide value
00308         or default is set).
00309 
00310         Note:  Need to add checks for sitewide policies!!!
00311         """
00312         if not self.isSiteSyndicationAllowed():
00313             raise 'Syndication is not Allowed'
00314 
00315         if obj is None:
00316             return self.syUpdateFrequency
00317 
00318         syInfo = getattr(obj, 'syndication_information',
00319                             None)
00320         if syInfo is not None:
00321             return syInfo.syUpdateFrequency
00322         else:
00323             return 'Syndication is not Allowed'

Here is the call graph for this function:

Return the update period for the RSS syn namespace.
This is either on the object being passed or the
portal_syndication tool (if a sitewide value or default
is set)

NOTE:  Need to add checks for sitewide policies!!!

Definition at line 279 of file SyndicationTool.py.

00279 
00280     def getUpdatePeriod( self, obj=None ):
00281         """
00282         Return the update period for the RSS syn namespace.
00283         This is either on the object being passed or the
00284         portal_syndication tool (if a sitewide value or default
00285         is set)
00286 
00287         NOTE:  Need to add checks for sitewide policies!!!
00288         """
00289         if not self.isSiteSyndicationAllowed():
00290             raise 'Syndication is Not Allowed'
00291 
00292         if obj is None:
00293             return self.syUpdatePeriod
00294 
00295         syInfo = getattr(obj, 'syndication_information', None)
00296 
00297         if syInfo is not None:
00298             return syInfo.syUpdatePeriod
00299         else:
00300             return 'Syndication is Not Allowed'

Here is the call graph for this function:

Return sitewide syndication policy

Definition at line 257 of file SyndicationTool.py.

00257 
00258     def isSiteSyndicationAllowed(self):
00259         """
00260         Return sitewide syndication policy
00261         """
00262         return self.isAllowed

Here is the caller graph for this function:

Check whether syndication is enabled for the site.  This
provides for extending the method to check for whether a
particular obj is enabled, allowing for turning on only
specific folders for syndication.

Definition at line 264 of file SyndicationTool.py.

00264 
00265     def isSyndicationAllowed(self, obj=None):
00266         """
00267         Check whether syndication is enabled for the site.  This
00268         provides for extending the method to check for whether a
00269         particular obj is enabled, allowing for turning on only
00270         specific folders for syndication.
00271         """
00272         syInfo = getattr(aq_base(obj), 'syndication_information',
00273                          None)
00274         if syInfo is None:
00275             return 0
00276         else:
00277             return self.isSiteSyndicationAllowed()

Here is the call graph for this function:


Member Data Documentation

CMFDefault.SyndicationTool.SyndicationTool.__implements__ = SimpleItem.__implements__ [static, private]

Definition at line 49 of file SyndicationTool.py.

string CMFDefault.SyndicationTool.SyndicationTool.id = 'portal_syndication' [static]

Definition at line 51 of file SyndicationTool.py.

Definition at line 57 of file SyndicationTool.py.

Definition at line 113 of file SyndicationTool.py.

Initial value:
( ( { 'label'  : 'Overview'
                         , 'action' : 'overview'
                         , 'help'   : ( 'CMFDefault'
                                      , 'Syndication-Tool_Overview.stx' )
                         }
                        ,{ 'label'  : 'Properties'
                         , 'action' : 'propertiesForm'
                         , 'help'   : ( 'CMFDefault'
                                      , 'Syndication-Tool_Properties.stx' )
                         }
                        ,{ 'label'  : 'Policies'
                         , 'action' : 'policiesForm'
                         , 'help'   : ( 'CMFDefault'
                                      , 'Syndication-Tool_Policies.stx' )
                         }
                        ,{ 'label'  : 'Reports'
                         , 'action' : 'reportForm'
                         , 'help'   : ( 'CMFDefault'
                                      , 'Syndication-Tool_Reporting.stx' )
                         }
                        )
                     )

Definition at line 64 of file SyndicationTool.py.

Definition at line 61 of file SyndicationTool.py.

Definition at line 142 of file SyndicationTool.py.

string CMFDefault.SyndicationTool.SyndicationTool.meta_type = 'Default Syndication Tool' [static]

Definition at line 52 of file SyndicationTool.py.

tuple CMFDefault.SyndicationTool.SyndicationTool.overview = HTMLFile('synOverview', _dtmldir) [static]

Definition at line 88 of file SyndicationTool.py.

tuple CMFDefault.SyndicationTool.SyndicationTool.policiesForm = HTMLFile('synPolicies', _dtmldir) [static]

Definition at line 94 of file SyndicationTool.py.

tuple CMFDefault.SyndicationTool.SyndicationTool.propertiesForm = HTMLFile('synProps', _dtmldir) [static]

Definition at line 91 of file SyndicationTool.py.

tuple CMFDefault.SyndicationTool.SyndicationTool.reportForm = HTMLFile('synReports', _dtmldir) [static]

Definition at line 97 of file SyndicationTool.py.

tuple CMFDefault.SyndicationTool.SyndicationTool.security = ClassSecurityInfo() [static]

Definition at line 54 of file SyndicationTool.py.

Definition at line 60 of file SyndicationTool.py.

Definition at line 134 of file SyndicationTool.py.

Definition at line 59 of file SyndicationTool.py.

Definition at line 124 of file SyndicationTool.py.

Definition at line 58 of file SyndicationTool.py.

Definition at line 116 of file SyndicationTool.py.


The documentation for this class was generated from the following file: