commit - 7c41d2555ab3a031a8ec5b52779a65413fc33939
commit + 3e30fc1ff40964a1f98ac42ab395898930878131
blob - 0ef848b046556ce47cd1009940c80817b1a60558
blob + cea5f1d2a22257deeca388cba3768c50ed9aaf22
--- lonk.py
+++ lonk.py
html TEXT,
date TEXT,
public INTEGER,
+ handles TEXT,
FOREIGN KEY (client_id) REFERENCES client (client_id),
UNIQUE (convoy, client_id),
UNIQUE (honk_id, client_id)
class _LonkTreeItem:
- def __init__(self, convoy_id, convoy, honk_id, honker, url, html, date, public):
+ def __init__(self, convoy_id, convoy, honk_id, honker, url, html, date, public, handles):
self.convoy_id = convoy_id
self.convoy = convoy
self.honk_id = honk_id
self.html = html
self.date = date
self.public = bool(public)
+ self.handles = handles
self.donks = []
self.reposters = []
self.thread = []
"HTML": self.html,
"Date": self.date,
"Public": self.public,
+ "Handles": self.handles,
"Donks": [
{"URL": donk[0], "Media": donk[1], "Desc": donk[2]}
for donk in self.donks
if convoy not in lonk_page:
row = db_con.execute(
- "SELECT convoy_id, convoy, honk_id, honker, url, html, date, public FROM convoy WHERE client_id=? AND convoy=?",
+ "SELECT convoy_id, convoy, honk_id, honker, url, html, date, public, handles FROM convoy WHERE client_id=? AND convoy=?",
(client_id, convoy)
).fetchone()
if row:
row = db_con.execute(
"""
INSERT INTO
- convoy(convoy, client_id, honk_id, honker, url, html, date, public)
+ convoy(convoy, client_id, honk_id, honker, url, html, date, public, handles)
VALUES
- (?, ?, ?, ?, ?, ?, ?, ?)
+ (?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING
convoy_id
""",
- (convoy, client_id, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public)
+ (convoy, client_id, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public, honk["Handles"])
).fetchone()
convoy_id, = row
lonk_page[convoy] = _LonkTreeItem(
- convoy_id, convoy, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public
+ convoy_id, convoy, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public, honk["Handles"]
)
for donk in (honk.get("Donks") or []):
_save_convoy(convoy, honker, honk_in_convoy)
break
else:
- _save_convoy(convoy, None, {"ID": None, "XID": None, "HTML": None, "Date": None})
+ _save_convoy(convoy, None, {"ID": None, "XID": None, "HTML": None, "Date": None, "Handles": None})
else:
_save_convoy(convoy, honk.get("Oondle") or honk["Handle"], honk)