[PATCH 1/3] emit PubSubHubbub atom:link tags in rss10 and rss20

Matt Domsch Matt_Domsch at dell.com
Wed Jun 16 02:30:18 EST 2010


>From df4e8bc130aa1b4ee03dcf6bb14ab4aa6ed30750 Mon Sep 17 00:00:00 2001
From: Matt Domsch <Matt_Domsch at dell.com>
Date: Tue, 15 Jun 2010 00:56:07 -0500
Subject: [PATCH 1/3] emit PubSubHubbub atom:link tags in rss10 and rss20

---
 planet/config.py             |    2 ++
 planet/shell/tmpl.py         |    1 +
 themes/common/rss10.xml.tmpl |    4 ++++
 themes/common/rss20.xml.tmpl |    5 ++++-
 4 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/planet/config.py b/planet/config.py
index 0b7f5a4..c066a6a 100644
--- a/planet/config.py
+++ b/planet/config.py
@@ -105,6 +105,8 @@ def __init__():
     define_planet('output_theme', '')
     define_planet('output_dir', 'output')
     define_planet('spider_threads', 0) 
+    # set pubsubhubbub_hub to None to prevent it from being emitted
+    define_planet('pubsubhubbub_hub', 'http://pubsubhubbub.appspot.com') 
 
     define_planet_int('new_feed_items', 0) 
     define_planet_int('feed_timeout', 20)
diff --git a/planet/shell/tmpl.py b/planet/shell/tmpl.py
index d81a7ef..a99d7ae 100644
--- a/planet/shell/tmpl.py
+++ b/planet/shell/tmpl.py
@@ -219,6 +219,7 @@ def template_info(source):
     output['link'] = config.link()
     output['owner_name'] = config.owner_name()
     output['owner_email'] = config.owner_email()
+    output['pubsubhubbub_hub'] = config.pubsubhubbub_hub()
     if config.feed():
         output['feed'] = config.feed()
         output['feedtype'] = config.feed().find('rss')>=0 and 'rss' or 'atom'
diff --git a/themes/common/rss10.xml.tmpl b/themes/common/rss10.xml.tmpl
index cdaaa79..1652f5c 100644
--- a/themes/common/rss10.xml.tmpl
+++ b/themes/common/rss10.xml.tmpl
@@ -4,12 +4,16 @@
 	xmlns:dc="http://purl.org/dc/elements/1.1/"
 	xmlns:foaf="http://xmlns.com/foaf/0.1/"
 	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:atom="http://www.w3.org/2005/Atom"
 	xmlns="http://purl.org/rss/1.0/"
 >
 <channel rdf:about="<TMPL_VAR link ESCAPE="HTML">">
 	<title><TMPL_VAR name ESCAPE="HTML"></title>
 	<link><TMPL_VAR link ESCAPE="HTML"></link>
 	<description><TMPL_VAR name ESCAPE="HTML"> - <TMPL_VAR link ESCAPE="HTML"></description>
+	<TMPL_IF pubsubhubbub_hub>
+	<atom:link rel="hub" href="<TMPL_VAR pubsubhubbub_hub ESCAPE="HTML">"/>
+	</TMPL_IF>
 
 	<items>
 		<rdf:Seq>
diff --git a/themes/common/rss20.xml.tmpl b/themes/common/rss20.xml.tmpl
index 724a104..1503f12 100644
--- a/themes/common/rss20.xml.tmpl
+++ b/themes/common/rss20.xml.tmpl
@@ -1,11 +1,14 @@
 <?xml version="1.0"?>
-<rss version="2.0">
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 
 <channel>
 	<title><TMPL_VAR name></title>
 	<link><TMPL_VAR link ESCAPE="HTML"></link>
 	<language>en</language>
 	<description><TMPL_VAR name ESCAPE="HTML"> - <TMPL_VAR link ESCAPE="HTML"></description>
+	<TMPL_IF pubsubhubbub_hub>
+	<atom:link rel="hub" href="<TMPL_VAR pubsubhubbub_hub ESCAPE="HTML">"/>
+	</TMPL_IF>
 
 <TMPL_LOOP Items>
 <item>
-- 
1.7.0.1



More information about the devel mailing list