]> git.phdru.name Git - phdru.name/phdru.name.git/blobdiff - make-news.py
Feat: Python 3
[phdru.name/phdru.name.git] / make-news.py
index 6d6ab7db65019cad6b08ad5de80989704958f8aa..d120b30e1de75765e10aa2dae5abfbc693db730b 100755 (executable)
@@ -1,8 +1,8 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 # -*- coding: koi8-r -*-
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2006-2017 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2006-2024 PhiloSoft Design"
 
 import sys, os
 from news import get_news, write_if_changed
@@ -57,7 +57,7 @@ write_if_changed(os.path.join(root, "news.tmpl"), ''.join(new_text))
 
 namespace = {
     "title": "Oleg Broytman's Personal Page - News",
-    "baseURL": "http://phdru.name/",
+    "baseURL": "https://phdru.name/",
     "indexFile": "news.html",
     "description": "",
     "lang": lang,
@@ -69,7 +69,7 @@ namespace = {
 
 if lang == "ru":
     namespace["title"] = "Oleg Broytman's Personal Page - Russian News"
-    namespace["baseURL"] = baseURL = "http://phdru.name/Russian/"
+    namespace["baseURL"] = baseURL = "https://phdru.name/Russian/"
     for item in news_items:
         item.baseURL = baseURL
         if isinstance(item.title, bytes):
@@ -89,14 +89,8 @@ for item in news_items:
 atom_tmpl = atom_10(searchList=[namespace])
 rss_tmpl = rss_20(searchList=[namespace])
 
-try:
-    unicode
-except NameError:  # PY3
-    atom_tmpl = str(atom_tmpl)
-    rss_tmpl = str(rss_tmpl)
-else:
-    atom_tmpl = unicode(atom_tmpl).encode('koi8-r')
-    rss_tmpl = unicode(rss_tmpl).encode('koi8-r')
+atom_tmpl = str(atom_tmpl)
+rss_tmpl = str(rss_tmpl)
 
 write_if_changed(os.path.join(root, "atom_10.xml"), atom_tmpl)
 write_if_changed(os.path.join(root, "rss_20.xml"), rss_tmpl)