def render_page(self, handler): handler.send_response(200) handler.send_header('Content-type','text/html') handler.end_headers() self.common_headers(handler.wfile) self.write(handler.wfile, "<body>\n") user_email = Auth.get_user_email(handler) self.menu_bar(handler.wfile) # If there's a report start time specified use that. Otherwise, # generate the report according to the current time. query_components = urllib.parse.parse_qs(urlparse(handler.path).query) if 'report_start' in query_components: report_start = datetime.datetime.strptime( query_components['report_start'][0], Constants.datetime_fmt) report_start = Config.meeting_timezone.localize(report_start) report = Util.report_from_start(report_start) else: now = datetime.datetime.now(pytz.utc) report = Util.report(now) self.write(handler.wfile, "Report for the current week:") self.get_acks(handler.wfile, report) self.render_eng_updates(handler.wfile) self.write(handler.wfile, "</body></html>\n")
def render_eng_updates(self, wfile): self.write(wfile, "<p>Suggested eng updates:<br>") now = datetime.datetime.now(pytz.utc) report = Util.report(now) updates = DB.get_eng_updates(report, None) s = "<ol>" for upd in updates: s += "<li>{0}</li>".format(upd.msg) s += "</ol>" self.write(wfile, s)
def render_page(self, handler): handler.send_response(200) handler.send_header('Content-type', 'text/html') handler.end_headers() self.common_headers(handler.wfile) self.write( handler.wfile, """ <body> <form method=post action=/myacks accept-charset="UTF-8" id="action-form"> <input type="hidden" name="delete-id" id="delete-id"> <input type="hidden" name="delete-eng-update-id" id="delete-eng-update-id"> <input type="hidden" name="delete-bounty-id" id="delete-bounty-id"> <input type="hidden" name="close-bounty-id" id="close-bounty-id"> </form> """) user_email = Auth.get_user_email(handler) self.menu_bar(handler.wfile) # If there's a report start time specified use that. Otherwise, # generate the report according to the current time. query_components = urllib.parse.parse_qs(urlparse(handler.path).query) if 'report_start' in query_components: report_start = datetime.datetime.strptime( query_components['report_start'][0], Constants.datetime_fmt) report_start = Config.meeting_timezone.localize(report_start) report = Util.report_from_start(report_start) else: now = datetime.datetime.now(pytz.utc) report = Util.report(now) now = datetime.datetime.now(pytz.utc) self.report_header( handler.wfile, report, generate_links=True, msg="My acks for week:", ) self.get_my_acks(handler.wfile, user_email, report) self.render_my_eng_updates(handler.wfile, user_email, report) self.render_my_bounties(handler.wfile, user_email) self.write(handler.wfile, "</body></html>")
def do_get(self, handler): handler.send_response(200) handler.send_header('Content-type', 'text/html') handler.end_headers() self.common_headers(handler.wfile) self.write(handler.wfile, "<body>") user_email = Auth.get_user_email(handler) self.menu_bar(handler.wfile) num_acks, bounty = self.just_inserted(handler) if num_acks != 0: self.ack_butterbar(handler.wfile, '%d peer ack(s) saved :thumb-up:' % (num_acks)) elif bounty: self.ack_butterbar(handler.wfile, 'bounty saved :thumb-up:') now = datetime.datetime.now(pytz.utc) adjusted = Util.adjust_ack_ts(now) self.report_header( handler.wfile, Util.report(adjusted, slack=False), generate_links=False, msg="Sending acks for week:", ) self.generate_bounty_pane(handler.wfile) msg = """ <p1>How did they poke their head above the Roach's high expectations this week? <p> <form action=/ack method=post accept-charset="UTF-8"> <fieldset id="fieldset" disabled="true"> One ack per line:<br><textarea name=ack rows="10" cols="80"></textarea> <p> Haiku (one multi-line ack):<br><textarea name=haiku rows="4" cols="80"></textarea><br> <input type=submit><br> </fieldset> <fieldset id="fieldset-eng-updates" disabled="true"> Engineering updates: <img src="question-mark.png" height="16px" title="Suggest eng updates to Peter. Brag about your PR, your friend's PR, shout about a scary issue."> <br><textarea name=eng-updates rows="4" cols="80"></textarea><br> <input type=submit><br> </fieldset> </form> """ self.write(handler.wfile, msg) self.write(handler.wfile, "<p>Suggested eng updates:<br>") userID = Auth.get_user_email(handler) if userID is None: self.write(handler.wfile, "Not logged in") else: self.write(handler.wfile, "\n<table>\n") now = datetime.datetime.now(pytz.utc) report = Util.report(now) eng_updates = DB.get_eng_updates(report, None) for update in eng_updates: self.render_eng_update(handler.wfile, update) self.write(handler.wfile, "\n</table>\n") self.write(handler.wfile, "\n</body></html>\n")