def POST(self, caseid): if not support_db: return render_template("admin/cases", None, None, True, False) case = support_db.get_case(caseid) form = web.input() action = form.get("button","") {"SEND REPLY" : self.POST_sendreply, "UPDATE" : self.POST_update, "CLOSE CASE" : self.POST_closecase, "REOPEN CASE": self.POST_reopencase}[action](form,case) date_pretty_printer = lambda x: x.strftime("%B %d, %Y") last_email = case.history[-1]['text'] last_email = "\n".join("> %s"%x for x in textwrap.wrap(last_email)) admins = ((x.get_email(), x.get_name(), x.get_email() == case.assignee) for x in accounts.get_group("admin").members) return render_template("admin/case", case, last_email, admins, date_pretty_printer)
def get_admins(): """Returns a list of [email, name] for each admin member. """ return [[m.get_email(), m.get_name()] for m in accounts.get_group("admin").members]
def GET(self, caseid): if not support_db: return render_template("admin/cases", None, None, True, False) case = support_db.get_case(caseid) date_pretty_printer = lambda x: x.strftime("%B %d, %Y") if len(case.history) == 1: last_email = case.description else: last_email = case.history[-1]['text'] try: last_email = "\n".join(" > %s"%x for x in last_email.split("\n")) + "\n\n" except Exception: last_email = "" admins = ((x.get_email(), x.get_name(), x.get_email() == case.assignee) for x in accounts.get_group("admin").members) return render_template("admin/case", case, last_email, admins, date_pretty_printer)