fba.cursor.execute("SELECT blocker, blocked, block_level, reason, first_seen, last_seen FROM blocks ORDER BY first_seen DESC LIMIT ?", [config.get("rss_limit")])
result = fba.cursor.fetchall()
-
blocklist = []
- for blocker, blocked, block_level, reason, first_seen, last_seen in result:
- first_seen = utils.format_datetime(datetime.fromtimestamp(first_seen))
- if reason is None or reason == "":
- reason = "No reason provided."
- else:
- reason = "Provided reason: '" + reason + "'"
+ for row in result:
blocklist.append({
- "blocker" : blocker,
- "blocked" : blocked,
- "block_level": block_level,
- "reason" : reason,
- "first_seen" : first_seen,
- "last_seen" : last_seen,
+ "blocker" : row[0],
+ "blocked" : row[1],
+ "block_level": row[2],
+ "reason" : "Provided reason: '" + row[3] + "'" if row[3] is not None and row[3] != "" else "No reason provided.",
+ "first_seen" : utils.format_datetime(datetime.fromtimestamp(row[4])),
+ "last_seen" : utils.format_datetime(datetime.fromtimestamp(row[5])),
})
return templates.TemplateResponse("rss.xml", {