More python3 changes.
[kiosk.git] / generic_news_rss_renderer.py
index 849c1ad4a643bd724d952215c994567a609409cc..ec7a7a5d0e840c65a27284fbb98f9e6ea5e91dd2 100644 (file)
@@ -91,7 +91,7 @@ class generic_news_rss_renderer(renderer.debuggable_abstaining_renderer):
             return False
         for msg in subset:
             blurb = msg
-            blurb += "</TD>\n"
+            blurb += u'</TD>'
             details.add_item(blurb)
         g = file_writer.file_writer('%s_6_none.html' % (
             self.get_details_page_prefix()))
@@ -151,38 +151,24 @@ class generic_news_rss_renderer(renderer.debuggable_abstaining_renderer):
                 #print u"Title: %s\nDescription: %s\nLink: %s\nImage: %s\n" % (
                 #    title, description, link, image)
 
-                blurb = """<DIV style="padding:8px;
+                blurb = u"""<DIV style="padding:8px;
                                  font-size:34pt;
                                  -webkit-column-break-inside:avoid;">"""
                 if image is not None:
-                    blurb += '<IMG SRC="%s" ALIGN=LEFT HEIGHT=115 style="padding:8px;">\n' % image
-                blurb += '<P><B>%s</B>' % title
+                    blurb += u'<IMG SRC="%s" ALIGN=LEFT HEIGHT=115 style="padding:8px;">' % image
+                blurb += u'<P><B>%s</B>' % title
 
                 if (description is not None and
                     self.item_is_interesting_for_article(title, description, item)):
                     longblurb = blurb
-                    longblurb += "<BR>"
+                    longblurb += u"<BR>"
                     longblurb += description
-                    longblurb += "</DIV>"
+                    longblurb += u"</DIV>"
                     longblurb = longblurb.replace("font-size:34pt",
                                                   "font-size:44pt")
-                    self.details.add(longblurb.encode('utf-8', errors='ignore'))
+                    self.details.add(longblurb)
 
-                blurb += "</DIV>"
-                self.news.add(blurb.encode('utf-8', errors='ignore'))
+                blurb += u"</DIV>"
+                self.news.add(blurb)
                 count += 1
         return count > 0
-
-# Test
-#x = generic_news_rss_renderer(
-#    {"Fetch News" : 1,
-#     "Shuffle News" : 1},
-#    "rss.cnn.com",
-#    [ "/rss/generic_news_topstories.rss",
-#      "/rss/money_latest.rss",
-#      "/rss/generic_news_tech.rss",
-#    ],
-#    "Test" )
-#if x.fetch_news() == 0:
-#    print "Error fetching news, no items fetched."
-#x.shuffle_news()