summaryrefslogtreecommitdiffstats
path: root/web/macros.py
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-10-09 12:33:30 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-10-09 12:33:30 (GMT)
commitb3470843ef23a45c9a0bb81813ec0212a9fa9f06 (patch)
tree34cdcdfb24180a16b05127458e2342938a415c4b /web/macros.py
parent9a1faf90f43acffcb41f8aab310f19bd3b54c9bc (diff)
downloadsite-b3470843ef23a45c9a0bb81813ec0212a9fa9f06.tar.gz
web/macros.py: Use full URLs in RSS file
Make sure to specify URLs such as https://www.nagios-plugins.org/foo.html instead of /foo.html in the RSS file.
Diffstat (limited to 'web/macros.py')
-rw-r--r--web/macros.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/web/macros.py b/web/macros.py
index 5964c7b..27e91d5 100644
--- a/web/macros.py
+++ b/web/macros.py
@@ -9,6 +9,7 @@ page = {
9 "keywords": "Nagios, Icinga, Shinken, Monitoring, Official, Plugins, Open, Source, Free, Software" 9 "keywords": "Nagios, Icinga, Shinken, Monitoring, Official, Plugins, Open, Source, Free, Software"
10} 10}
11release_notes = 'doc/release-notes/' + plugins_release.replace('.', '-') + '.html' 11release_notes = 'doc/release-notes/' + plugins_release.replace('.', '-') + '.html'
12site_url = 'https://www.nagios-plugins.org/'
12 13
13_RSS = """<?xml version="1.0" encoding="UTF-8"?> 14_RSS = """<?xml version="1.0" encoding="UTF-8"?>
14<rss version="2.0"> 15<rss version="2.0">
@@ -43,14 +44,14 @@ def hook_postconvert_rss():
43 posts.sort(key=lambda p: p.date, reverse=True) 44 posts.sort(key=lambda p: p.date, reverse=True)
44 for p in posts: 45 for p in posts:
45 title = p.post 46 title = p.post
46 link = '%s/%s' % (options.base_url.rstrip('/'), p.url) 47 link = '%s/%s' % (site_url.rstrip('/'), p.url)
47 desc = hx(p.html) 48 desc = hx(p.html)
48 date = time.mktime(time.strptime('%s 12' % p.date, '%Y-%m-%d %H')) 49 date = time.mktime(time.strptime('%s 12' % p.date, '%Y-%m-%d %H'))
49 date = email.utils.formatdate(date) 50 date = email.utils.formatdate(date)
50 items.append(_RSS_ITEM % (title, link, desc, link, date)) 51 items.append(_RSS_ITEM % (title, link, desc, link, date))
51 items = ''.join(items) 52 items = ''.join(items)
52 title = 'Nagios Plugins' 53 title = 'Nagios Plugins'
53 link = '%s/news/index.html' % options.base_url.rstrip('/') 54 link = '%s/news/index.html' % site_url.rstrip('/')
54 desc = 'Announcements published by the Nagios Plugins Development Team.' 55 desc = 'Announcements published by the Nagios Plugins Development Team.'
55 date = email.utils.formatdate() 56 date = email.utils.formatdate()
56 rss = _RSS % (title, link, desc, date, date, items) 57 rss = _RSS % (title, link, desc, date, date, items)