def report_statusline(wiki, status, error=False): if error: # No state information, hide the timestamp stamp = "<span style=\"visible: none\">" + TimeUtils.pretty_time() + "</span>" else: stamp = TimeUtils.pretty_time() if wiki.is_private(): link = "%s (private data)" % wiki.db_name else: if wiki.date: link = "<a href=\"%s/%s\">%s</a>" % (wiki.db_name, wiki.date, wiki.db_name) else: link = "%s (new)" % wiki.db_name if wiki.is_closed(): link = link + " (closed)" return "<li>%s %s: %s</li>\n" % (stamp, link, status)
def report_failure(self): if self.email: if self.wiki.config.admin_mail and self.wiki.config.admin_mail.lower() != 'nomail': subject = "Dump failure for " + self.wiki.db_name message = self.wiki.config.read_template("errormail.txt") % { "db": self.wiki.db_name, "date": self.wiki.date, "time": TimeUtils.pretty_time(), "url": "/".join((self.wiki.config.web_root, self.wiki.db_name, self.wiki.date, ''))} self.mail(subject, message)
def report_statusline(wiki, status, error=False): """ given a wiki name, the status (done, in progress, etc), produce and return a line of html describing the status of the wiki, with a link to the wiki dump directory for the dump run date if appropriate """ if error: # No state information, hide the timestamp stamp = "<span style=\"visible: none\">" + TimeUtils.pretty_time() + "</span>" else: stamp = TimeUtils.pretty_time() if wiki.is_private(): link = "%s (private data)" % wiki.db_name else: if wiki.date: link = "<a href=\"%s/%s\">%s</a>" % (wiki.db_name, wiki.date, wiki.db_name) else: link = "%s (new)" % wiki.db_name if wiki.is_closed(): link = link + " (closed)" return "<li>%s %s: %s</li>\n" % (stamp, link, status)
def set_status(self, status, set_updated=True): self.runinfo["status"] = status if set_updated: self.runinfo["updated"] = TimeUtils.pretty_time()
def debug(self, stuff): self.log_and_print("%s: %s" % (TimeUtils.pretty_time(), stuff))
def debug(self, stuff): """ display a debugging message with wiki name and time, log it also if logging is enabled """ self.log_and_print("%s: %s %s" % (TimeUtils.pretty_time(), self.db_name, stuff))