logger.info("Checking %d CSV lines ...", len(rows))
for row in rows:
logger.debug("row[%s]='%s'", type(row), row)
+
+ # Init variables
domain = severity = reason = None
reject_media = reject_reports = False
- if "#domain" in row:
- domain = tidyup.domain(row["#domain"]) if row["#domain"] not in [None, ""] else None
- elif "domain" in row:
- domain = tidyup.domain(row["domain"]) if row["domain"] not in [None, ""] else None
- elif "Domain" in row:
- domain = tidyup.domain(row["Domain"]) if row["Domain"] not in [None, ""] else None
+ if "#domain" in row and row["#domain"] not in [None, ""]:
+ domain = tidyup.domain(row["#domain"])
+ elif "domain" in row and row["domain"] not in [None, ""]:
+ domain = tidyup.domain(row["domain"])
+ elif "Domain" in row and row["Domain"] not in [None, ""]:
+ domain = tidyup.domain(row["Domain"])
else:
logger.warning("row='%s' does not contain domain column - SKIPPED!", row)
continue
logger.debug("row='%s' does not contain severity column, setting 'reject'", row)
severity = "rejected"
- if "reason" in row:
- reason = tidyup.reason(row["reason"]) if row["reason"] not in [None, ""] else None
- elif "comment" in row:
- reason = tidyup.reason(row["comment"]) if row["comment"] not in [None, ""] else None
- elif "Comment" in row:
- reason = tidyup.reason(row["Comment"]) if row["Comment"] not in [None, ""] else None
+ if "reason" in row and row["reason"] not in [None, ""]:
+ reason = tidyup.reason(row["reason"])
+ elif "comment" in row and row["comment"] not in [None, ""]:
+ reason = tidyup.reason(row["comment"])
+ elif "Comment" in row and row["Comment"] not in [None, ""]:
+ reason = tidyup.reason(row["Comment"])
else:
logger.debug("row='%s' has no reason/comment key provided", row)
logger.debug("reject_media='%s',reject_reports='%s'", reject_media, reject_reports)
if reject_media:
+ logger.debug("blocker='%s',domain='%s',reject_media=True", blocker, domain)
block(blocker, domain, None, "reject_media")
if reject_reports:
+ logger.debug("blocker='%s',domain='%s',reject_reports=True", blocker, domain)
block(blocker, domain, None, "reject_reports")
logger.debug("Invoking commit() ...")