news now working. template needs stylesheet work.

workspace
Brendan Howell 7 years ago
parent aecc2902e3
commit 110241161f

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<title>${title}</title>
<title>NEWS</title>
<meta charset="utf-8">
<style type="text/css">
body {
@ -92,8 +92,8 @@
% for msg in inbox:
<tr>
<td>${msg.fromname} &lt;${msg.fromaddr}&gt;</td>
<td>${msg.subject}</td><td>${msg.date}</td>
<td>${msg["fromname"]} &lt;${msg["fromaddr"]}&gt;</td>
<td>${msg["subject"]}</td><td>${msg["date"]}</td>
</tr>
<tr><td> </td><td>READ</td><td>DELETE</td><td>MARK AS SPAM</td></tr>
<tr><td> </td><td>BC-READ</td><td>BC-DELETE</td><td>BC-MARK AS SPAM</td></tr>

@ -48,7 +48,7 @@ class Publications(Bureau):
res = "not None"
while res is not None:
tmpcode = _shortcode()
res = txn.get(tmpcode)
res = txn.get(tmpcode.encode())
txn.put(tmpcode.encode(), url.encode())
return tmpcode
@ -99,6 +99,7 @@ class Publications(Bureau):
# TODO: get weather
# TODO: get finance
inbox = self.send("PO", "unread")
print("news", news[0])
self.print_full("news.html", news=news, inbox=inbox)
@add_command("r", "Print a web page for reading")
@ -173,6 +174,10 @@ class Publications(Bureau):
entry = feed.entries.pop()
entry.source = feed.feed.title
entry.dbhash = self._make_shorturl(entry.link)
if hasattr(entry, "media_thumbnail"):
entry.img = entry.media_thumbnail[-1]["url"]
else:
entry.img = " "
# limit summary to the last space below 500 characters
if len(entry.summary) > 500:

Loading…
Cancel
Save