[PATCH 1 of 2] Fix whitespace

Wesley J. Landaker wjl at icecavern.net
Fri Jul 13 12:48:53 CDT 2007


# HG changeset patch
# User Wesley J. Landaker <wjl at icecavern.net>
# Date 1184348464 21600
# Node ID ea1a254b4a03c1c4a61b6bfb2a5ebbdeb27a17f8
# Parent  28b23b9073a8652f95b87975f6648912dfec5f71
Fix whitespace.

diff -r 28b23b9073a8 -r ea1a254b4a03 mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Fri Jul 13 08:28:57 2007 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Fri Jul 13 11:41:04 2007 -0600
@@ -787,17 +787,20 @@ class hgweb(object):
             style = req.form['style'][0]
         mapfile = style_map(self.templatepath, style)
 
-        proto = req.env.get('wsgi.url_scheme')
-        if proto == 'https':
-            proto = 'https'
-            default_port = "443"
-        else:
-            proto = 'http'
-            default_port = "80"
-
-        port = req.env["SERVER_PORT"]
-        port = port != default_port and (":" + port) or ""
-        urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
+        # use [web]/baseurl if set, otherwise use heuristic
+        baseurl = self.config("web", "baseurl")
+        if not baseurl:
+            proto = req.env.get('wsgi.url_scheme')
+            if proto == 'https':
+                proto = 'https'
+                default_port = "443"
+            else:
+                proto = 'http'
+                default_port = "80"
+            port = req.env["SERVER_PORT"]
+            port = port != default_port and (":" + port) or ""
+            baseurl = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
+            
         staticurl = self.config("web", "staticurl") or req.url + 'static/'
         if not staticurl.endswith('/'):
             staticurl += '/'
@@ -810,7 +813,8 @@ class hgweb(object):
         self.t = templater.templater(mapfile, templater.common_filters,
                                      defaults={"url": req.url,
                                                "staticurl": staticurl,
-                                               "urlbase": urlbase,
+                                               "baseurl": baseurl,
+                                               "urlbase": baseurl, # backwards compatibility only
                                                "repo": self.reponame,
                                                "header": header,
                                                "footer": footer,
diff -r 28b23b9073a8 -r ea1a254b4a03 templates/rss/changelogentry.tmpl
--- a/templates/rss/changelogentry.tmpl	Fri Jul 13 08:28:57 2007 -0700
+++ b/templates/rss/changelogentry.tmpl	Fri Jul 13 11:41:04 2007 -0600
@@ -1,6 +1,6 @@
 <item>
     <title>#desc|strip|firstline|strip|escape#</title>
-    <link>{urlbase}{url}rev/{node|short}</link>
+    <link>{baseurl}{url}rev/{node|short}</link>
     <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
     <author>#author|obfuscate#</author>
     <pubDate>#date|rfc822date#</pubDate>
diff -r 28b23b9073a8 -r ea1a254b4a03 templates/rss/filelogentry.tmpl
--- a/templates/rss/filelogentry.tmpl	Fri Jul 13 08:28:57 2007 -0700
+++ b/templates/rss/filelogentry.tmpl	Fri Jul 13 11:41:04 2007 -0600
@@ -1,6 +1,6 @@
 <item>
     <title>#desc|strip|firstline|strip|escape#</title>
-    <link>{urlbase}{url}log{#node|short#}/{file|urlescape}</link>
+    <link>{baseurl}{url}log{#node|short#}/{file|urlescape}</link>
     <description><![CDATA[#desc|strip|escape|addbreaks#]]></description>
     <author>#author|obfuscate#</author>
     <pubDate>#date|rfc822date#</pubDate>
diff -r 28b23b9073a8 -r ea1a254b4a03 templates/rss/header.tmpl
--- a/templates/rss/header.tmpl	Fri Jul 13 08:28:57 2007 -0700
+++ b/templates/rss/header.tmpl	Fri Jul 13 11:41:04 2007 -0600
@@ -3,5 +3,5 @@ Content-type: text/xml; charset={encodin
 <?xml version="1.0" encoding="{encoding}"?>
 <rss version="2.0">
   <channel>
-    <link>{urlbase}{url}</link>
+    <link>{baseurl}{url}</link>
     <language>en-us</language>
diff -r 28b23b9073a8 -r ea1a254b4a03 templates/rss/tagentry.tmpl
--- a/templates/rss/tagentry.tmpl	Fri Jul 13 08:28:57 2007 -0700
+++ b/templates/rss/tagentry.tmpl	Fri Jul 13 11:41:04 2007 -0600
@@ -1,6 +1,6 @@
 <item>
     <title>#tag|escape#</title>
-    <link>{urlbase}{url}rev/{node|short}</link>
+    <link>{baseurl}{url}rev/{node|short}</link>
     <description><![CDATA[#tag|strip|escape|addbreaks#]]></description>
     <pubDate>#date|rfc822date#</pubDate>
 </item>


More information about the Mercurial-devel mailing list