2 # -*- coding: koi8-r -*-
4 __author__ = "Oleg Broytman <phd@phdru.name>"
5 __copyright__ = "Copyright (C) 2006-2012 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
77 for item in news_items:
78 href_parts = item.rel_link.split('/')
80 if href_parts[0] == '.':
81 category = "Home page"
82 elif href_parts[0] == "..":
83 category = href_parts[1]
85 category = href_parts[0]
86 if category: item.categoryList = [category]
88 atom_tmpl = str(atom_10(searchList=[namespace]))
89 write_if_changed(os.path.join(root, "atom_10.xml"), atom_tmpl)
90 rss_tmpl = str(rss_20(searchList=[namespace]))
91 write_if_changed(os.path.join(root, "rss_20.xml"), rss_tmpl)