def format_issue(kind_id): kind = CrashKind.get(id=kind_id) crashes = Crash.select().where(Crash.kind_id == kind_id) reporter_table = "" additional = [] for c in crashes: stack_url = config.get("external_url") + "/crash/" + str(c.id) reporter_table += reporter_row.format( stack_url=stack_url, **model_to_dict(c)).replace("\n", " ") + "\n" if c.description: additional.append(c.description) v = { "stack": crashes[0].stack, "type": kind.type, "exc_string": crashes[0].exc_string, "reporter_table": reporter_table, "user_count": len(crashes), "app_name": config.get("app_name") } report = template.format(**v) if additional: for a in additional: report += "\n> ".join([""] + a.splitlines()) report += "\n\n---\n\n" else: report += no_info title = kind.type + ": " + crashes[0].exc_string if len(title) > 400: title = title[:400] + "..." return title, report
def format_issue(kind_id): kind = CrashKind.get(id=kind_id) crashes = Crash.select().where(Crash.kind_id == kind_id) reporter_table = "" additional = [] for c in crashes: reporter_table += reporter_row.format(**c._data) if c.description: additional.append(c.description) v = { "stack": crashes[0].stack, "type": kind.type, "exc_string": crashes[0].exc_string, "reporter_table": reporter_table, "user_count": len(crashes) } report = template.format(**v) if additional: for a in additional: report += "\n> ".join([""] + a.splitlines()) report += "\n\n---\n\n" else: report += no_info title = kind.type + ": " + crashes[0].exc_string return title, report
def format_reopen_comment(kind_id, closed_by): kind = CrashKind.get(id=kind_id) crashes = Crash.select().where(Crash.kind_id == kind_id) if len(crashes) < 2: return None crashes, new_crash = crashes[:-1], crashes[-1:][0] min_version = None for c in crashes: if not min_version or LooseVersion(min_version) < LooseVersion(c.app_version): min_version = c.app_version if not LooseVersion(min_version) < LooseVersion(new_crash.app_version): return None v = { "greeting": get_greeting(), "user_closed": closed_by.login, "app_name": config.get("app_name"), "version": new_crash.app_version, "min_version": min_version, "stack": new_crash.stack, "type": kind.type, "exc_string": new_crash.exc_string } return template_reopen.format(**v)