From: Oleg Broytman Date: Fri, 17 Mar 2006 12:06:34 +0000 (+0000) Subject: For urljoin() to remove ".." components baseURL must ends in a slash. X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=81cad035ca8ae880554bea9fe65c1f6391cca268;p=phdru.name%2Fphdru.name.git For urljoin() to remove ".." components baseURL must ends in a slash. git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@34 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- diff --git a/atom_10.tmpl b/atom_10.tmpl index 0cc3ce8..8c601e0 100644 --- a/atom_10.tmpl +++ b/atom_10.tmpl @@ -1,9 +1,9 @@ $title - $baseURL/news.html - - + ${baseURL}news.html + + ${posts[0].date}T00:00:00Z $author diff --git a/make-news.py b/make-news.py index a654c26..2fcb716 100755 --- a/make-news.py +++ b/make-news.py @@ -40,7 +40,7 @@ from rss_20 import rss_20 namespace = { "title": "Oleg Broytmann's Personal Page - News", - "baseURL": "http://phd.pp.ru", + "baseURL": "http://phd.pp.ru/", "description": "", "lang": lang, "author": "Oleg Broytmann", @@ -50,7 +50,8 @@ namespace = { if lang == "ru": namespace["title"] = "Oleg Broytmann's Personal Page - Russian News" - namespace["baseURL"] = "http://phd.pp.ru/Russian" + namespace["baseURL"] = baseURL = "http://phd.pp.ru/Russian/" + for item in news_items: item.baseURL = baseURL atom_tmpl = str(atom_10(searchList=[namespace])) write_if_changed(os.path.join(root, "atom_10.xml"), atom_tmpl) diff --git a/news.py b/news.py index b091cbd..38bdf56 100644 --- a/news.py +++ b/news.py @@ -14,6 +14,7 @@ from datetime import date from urlparse import urljoin class NewsItem(object): + baseURL = "http://phd.pp.ru/" excerpt = None content = None categoryList = [] @@ -24,7 +25,7 @@ class NewsItem(object): self.rel_link = rel_link def URL(self): - return urljoin("http://phd.pp.ru/", self.rel_link) + return urljoin(self.baseURL, self.rel_link) def rfc822_date(self): y, m, d = self.date.split('-') diff --git a/rss_20.tmpl b/rss_20.tmpl index 09b646a..1ead69c 100644 --- a/rss_20.tmpl +++ b/rss_20.tmpl @@ -2,7 +2,7 @@ $title - $baseURL/news.html + ${baseURL}news.html $description $lang $author <$email>