2 # -*- coding: koi8-r -*-
4 __author__ = "Oleg Broytman <phd@phdru.name>"
5 __copyright__ = "Copyright (C) 2006-2014 PhiloSoft Design"
8 from news import get_news, write_if_changed
13 header, news_items = get_news(lang)
21 for item in news_items:
22 new_text.append(' <li><a href="%s">%s - %s</a></li>\n' % (item.rel_link, item.date, item.title))
32 News are also available in
33 <A HREF="atom_10.xml">Atom 1.0 <img src="Graphics/atom_10.jpg" border=0></A>
34 and <A HREF="rss_20.xml">RSS 2.0 <img src="Graphics/rss_20.jpg" border=0></A>
40 Новостевая лента в форматах
41 <A HREF="atom_10.xml">Atom 1.0 <img src="../Graphics/atom_10.jpg" border=0></A>
42 и <A HREF="rss_20.xml">RSS 2.0 <img src="../Graphics/rss_20.jpg" border=0></A>.
48 $phd_site.respond(self)
51 write_if_changed(os.path.join(root, "news.tmpl"), ''.join(new_text))
54 from atom_10 import atom_10
55 from rss_20 import rss_20
58 "title": "Oleg Broytman's Personal Page - News",
59 "baseURL": "http://phdru.name/",
60 "indexFile": "news.html",
63 "author": "Oleg Broytman",
64 "email": "phd@phdru.name",
65 "generator": os.path.basename(sys.argv[0]),
70 namespace["title"] = "Oleg Broytman's Personal Page - Russian News"
71 namespace["baseURL"] = baseURL = "http://phdru.name/Russian/"
72 for item in news_items:
73 item.baseURL = baseURL
74 item.title = item.title.decode('koi8-r').encode('utf-8')
76 for item in news_items:
77 href_parts = item.rel_link.split('/')
79 if href_parts[0] == '.':
80 category = "Home page"
81 elif href_parts[0] == "..":
82 category = href_parts[1]
84 category = href_parts[0]
85 if category: item.categoryList = [category]
87 atom_tmpl = unicode(atom_10(searchList=[namespace])).encode('koi8-r')
88 write_if_changed(os.path.join(root, "atom_10.xml"), atom_tmpl)
89 rss_tmpl = unicode(rss_20(searchList=[namespace])).encode('koi8-r')
90 write_if_changed(os.path.join(root, "rss_20.xml"), rss_tmpl)