Fix RSS URLs (closes issue396)
authorBrendan Cully <brendan@kublai.com>
Mon, 16 Oct 2006 11:18:06 -0700
changeset 3423 a2179e78d18b
parent 3422 0eba7e76cd02
child 3424 9b1c126b74cd
Fix RSS URLs (closes issue396)
mercurial/hgweb/hgweb_mod.py
templates/rss/changelogentry.tmpl
templates/rss/filelogentry.tmpl
templates/rss/header.tmpl
templates/rss/tagentry.tmpl
--- a/mercurial/hgweb/hgweb_mod.py	Mon Oct 16 11:02:11 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Oct 16 11:18:06 2006 -0700
@@ -744,13 +744,9 @@
             style = req.form['style'][0]
         mapfile = style_map(self.templatepath, style)
 
-        if not req.url:
-            port = req.env["SERVER_PORT"]
-            port = port != "80" and (":" + port) or ""
-            uri = req.env["REQUEST_URI"]
-            if "?" in uri:
-                uri = uri.split("?")[0]
-            req.url = "http://%s%s%s" % (req.env["SERVER_NAME"], port, uri)
+        port = req.env["SERVER_PORT"]
+        port = port != "80" and (":" + port) or ""
+        urlbase = 'http://%s%s' % (req.env['SERVER_NAME'], port)
 
         if not self.reponame:
             self.reponame = (self.repo.ui.config("web", "name")
@@ -759,6 +755,7 @@
 
         self.t = templater.templater(mapfile, templater.common_filters,
                                      defaults={"url": req.url,
+                                               "urlbase": urlbase,
                                                "repo": self.reponame,
                                                "header": header,
                                                "footer": footer,
--- a/templates/rss/changelogentry.tmpl	Mon Oct 16 11:02:11 2006 -0700
+++ b/templates/rss/changelogentry.tmpl	Mon Oct 16 11:18:06 2006 -0700
@@ -1,6 +1,6 @@
 <item>
     <title>#desc|strip|firstline|strip|escape#</title>
-    <link>#url#?cs=#node|short#</link>
+    <link>{urlbase}{url}rev/{node|short}</link>
     <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
     <author>#author|obfuscate#</author>
     <pubDate>#date|rfc822date#</pubDate>
--- a/templates/rss/filelogentry.tmpl	Mon Oct 16 11:02:11 2006 -0700
+++ b/templates/rss/filelogentry.tmpl	Mon Oct 16 11:18:06 2006 -0700
@@ -1,6 +1,6 @@
 <item>
     <title>#desc|strip|firstline|strip|escape#</title>
-    <link>#url#?f=#node|short#;file=#file|urlescape#</link>
+    <link>{urlbase}{url}log{#node|short#}/{file|urlescape}</link>
     <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
     <author>#author|obfuscate#</author>
     <pubDate>#date|rfc822date#</pubDate>
--- a/templates/rss/header.tmpl	Mon Oct 16 11:02:11 2006 -0700
+++ b/templates/rss/header.tmpl	Mon Oct 16 11:18:06 2006 -0700
@@ -2,5 +2,5 @@
 
 <rss version="2.0">
   <channel>
-    <link>#url#</link>
+    <link>{urlbase}{url}</link>
     <language>en-us</language>
--- a/templates/rss/tagentry.tmpl	Mon Oct 16 11:02:11 2006 -0700
+++ b/templates/rss/tagentry.tmpl	Mon Oct 16 11:18:06 2006 -0700
@@ -1,6 +1,6 @@
 <item>
     <title>#tag|escape#</title>
-    <link>#url#?cs=#node|short#</link>
+    <link>{urlbase}{url}rev/{node|short}</link>
     <description><![CDATA[#tag|strip|escape|addbreaks#]]></description>
     <pubDate>#date|rfc822date#</pubDate>
 </item>