2 # -*- coding: koi8-r -*-
4 __author__ = "Oleg Broytman <phd@phdru.name>"
5 __copyright__ = "Copyright (C) 2006-2013 PhiloSoft Design"
8 from news import get_news, write_if_changed
13 header, news_items = get_news(lang)
22 for item in news_items:
23 new_text.append(' <li><a href="%s">%s - %s</a></li>\n' % (item.rel_link, item.date, item.title))
34 News are also available in
35 <A HREF="atom_10.xml">Atom 1.0 <img src="Graphics/atom_10.jpg" border=0></A>
36 and <A HREF="rss_20.xml">RSS 2.0 <img src="Graphics/rss_20.jpg" border=0></A>
42 Новостевая лента в форматах
43 <A HREF="atom_10.xml">Atom 1.0 <img src="../Graphics/atom_10.jpg" border=0></A>
44 и <A HREF="rss_20.xml">RSS 2.0 <img src="../Graphics/rss_20.jpg" border=0></A>.
50 $phd_site.respond(self)
53 write_if_changed(os.path.join(root, "news.tmpl"), ''.join(new_text))
56 from atom_10 import atom_10
57 from rss_20 import rss_20
60 "title": "Oleg Broytman's Personal Page - News",
61 "baseURL": "http://phdru.name/",
62 "indexFile": "news.html",
65 "author": "Oleg Broytman",
66 "email": "phd@phdru.name",
67 "generator": os.path.basename(sys.argv[0]),
72 namespace["title"] = "Oleg Broytman's Personal Page - Russian News"
73 namespace["baseURL"] = baseURL = "http://phdru.name/Russian/"
74 for item in news_items:
75 item.baseURL = baseURL
76 item.title = item.title.decode('koi8-r').encode('utf-8')
78 for item in news_items:
79 href_parts = item.rel_link.split('/')
81 if href_parts[0] == '.':
82 category = "Home page"
83 elif href_parts[0] == "..":
84 category = href_parts[1]
86 category = href_parts[0]
87 if category: item.categoryList = [category]
89 atom_tmpl = unicode(atom_10(searchList=[namespace])).encode('koi8-r')
90 write_if_changed(os.path.join(root, "atom_10.xml"), atom_tmpl)
91 rss_tmpl = unicode(rss_20(searchList=[namespace])).encode('koi8-r')
92 write_if_changed(os.path.join(root, "rss_20.xml"), rss_tmpl)