[CMF-checkins] CVS: Products/CMFDefault/skins/zpt_generic - RSS.py:1.2 RSS_template.pt:1.2

Yvo Schubbe y.2004_ at wcm-solutions.de
Wed Sep 1 11:25:48 EDT 2004


Update of /cvs-repository/Products/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv29175/CMFDefault/skins/zpt_generic

Added Files:
	RSS.py RSS_template.pt 
Log Message:
- added missing RSS script and template (http://zope.org/Collectors/CMF/279)


=== Products/CMFDefault/skins/zpt_generic/RSS.py 1.1 => 1.2 ===
--- /dev/null	Wed Sep  1 11:25:48 2004
+++ Products/CMFDefault/skins/zpt_generic/RSS.py	Wed Sep  1 11:25:48 2004
@@ -0,0 +1,43 @@
+##parameters=
+##
+from ZTUtils import Batch
+from ZTUtils import LazyFilter
+from Products.CMFCore.utils import getToolByName
+
+stool = getToolByName(script, 'portal_syndication')
+
+
+if not stool.isSyndicationAllowed(context):
+    context.REQUEST.RESPONSE.redirect(context.absolute_url() +
+             '/rssDisabled?portal_status_message=Syndication+is+Disabled')
+    return
+
+
+options = {}
+
+options['channel_info'] = { 'base': stool.getHTML4UpdateBase(context),
+                            'description': context.Description(),
+                            'frequency': stool.getUpdateFrequency(context),
+                            'period': stool.getUpdatePeriod(context),
+                            'title': context.Title(),
+                            'url': context.absolute_url() }
+
+key, reverse = context.getDefaultSorting()
+items = stool.getSyndicatableContent(context)
+items = sequence.sort( items, ((key, 'cmp', reverse and 'desc' or 'asc'),) )
+items = LazyFilter(items, skip='View')
+b_size = stool.getMaxItems(context)
+batch_obj = Batch(items, b_size, 0, orphan=0)
+items = []
+for item in batch_obj:
+    items.append( { 'date': item.modified().HTML4(),
+                    'description': item.Description(),
+                    'listCreators': item.listCreators(),
+                    'listSubjects': item.Subject(),
+                    'publisher': item.Publisher(),
+                    'rights': item.Rights(),
+                    'title': item.Title(),
+                    'url': item.absolute_url() } )
+options['listItemInfos'] = tuple(items)
+
+return context.RSS_template(**options)


=== Products/CMFDefault/skins/zpt_generic/RSS_template.pt 1.1 => 1.2 ===
--- /dev/null	Wed Sep  1 11:25:48 2004
+++ Products/CMFDefault/skins/zpt_generic/RSS_template.pt	Wed Sep  1 11:25:48 2004
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<rdf:RDF
+    xmlns:tal="http://xml.zope.org/namespaces/tal"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+    xmlns="http://purl.org/rss/1.0/">
+  <channel rdf:about="URL"
+      tal:define="channel_info options/channel_info"
+      tal:attributes="rdf:about channel_info/url">
+    <title tal:content="channel_info/title">TITLE</title>
+    <link tal:content="channel_info/url">URL</link>
+    <description
+        tal:content="channel_info/description">DESCRIPTION</description>
+    <image rdf:resource="logo.png" />
+    <sy:updatePeriod
+        tal:content="channel_info/period">PERIOD</sy:updatePeriod>
+    <sy:updateFrequency
+        tal:content="channel_info/frequency">N</sy:updateFrequency>
+    <sy:updateBase
+        tal:content="channel_info/base">YYYY-MM-DDTHH:MM:SSZ</sy:updateBase>
+    <items>
+      <rdf:Seq>
+        <rdf:li resource="URL"
+            tal:repeat="item_info options/listItemInfos"
+            tal:attributes="resource item_info/url" />
+      </rdf:Seq>
+    </items>
+  </channel>
+  <item rdf:about="URL"
+      tal:repeat="item_info options/listItemInfos"
+      tal:attributes="rdf:about item_info/url">
+    <title tal:content="item_info/title">TITLE</title>
+    <link tal:content="item_info/url">URL</link>
+    <description
+        tal:condition="item_info/description"
+        tal:content="item_info/description">DESCRIPTION</description>
+    <dc:publisher
+        tal:condition="item_info/publisher"
+        tal:content="item_info/publisher">PUBLISHER</dc:publisher>
+    <dc:creator
+        tal:repeat="creator item_info/listCreators"
+        tal:content="creator">CREATOR</dc:creator>
+    <dc:rights
+        tal:condition="item_info/rights"
+        tal:content="item_info/rights">RIGHTS</dc:rights>
+    <dc:subject
+        tal:repeat="subject item_info/listSubjects"
+        tal:content="subject">SUBJECT</dc:subject>
+    <dc:date tal:content="item_info/date">YYYY-MM-DDTHH:MM:SSZ</dc:date>
+  </item>
+</rdf:RDF>



More information about the CMF-checkins mailing list