Exemple #1
0
def store_crash():
    if not check_rate_limit(request):
        return "Thanks for reporting this issue!"
    crash = json.loads(request.data)
    # Give Windows paths forward slashes
    crash["id"]["file"] = crash["id"]["file"].replace("\\", "/")
    # We only care about the file name
    crash["id"]["file"] = os.path.split(crash["id"]["file"])[1]
    kind, created = CrashKind.get_or_create(**crash["id"])
    del crash["id"]
    crash["kind_id"] = kind.id
    Crash.create(**crash)
    title, body = issues.format_issue(kind.id)
    if created:
        issue = github.report_issue(title, body)
        kind.github_id = issue
        kind.save()
    else:
        github.update_issue(kind.github_id, title, body)
    url = "https://github.com/{}/issues/{}".format(config.get("github_project"), kind.github_id)
    return """
    Thanks for reporting this issue! You can track further progress on <a href="{url}">GitHub</a>.
    """.format(url=url)
Exemple #2
0
def store_crash(request):
    if not check_rate_limit(request):
        return {
            "text": "Thanks for reporting this issue!",
            "status": "skip",
            "location": None
        }
    crash = json.loads(request.data)
    # Give Windows paths forward slashes
    crash["id"]["file"] = crash["id"]["file"].replace("\\", "/")
    # We only care about the file name
    crash["id"]["file"] = os.path.split(crash["id"]["file"])[1]
    kind, created = CrashKind.get_or_create(**crash["id"])
    del crash["id"]
    crash["kind_id"] = kind.id
    Crash.create(**crash)
    title, body = issues.format_issue(kind.id)
    if kind.github_id < 0:
        issue = github.report_issue(title, body)
        kind.github_id = issue
        kind.save()
    else:
        github.update_issue(kind.github_id, body)
        if github.issue_is_closed(kind.github_id):
            body = issues.format_reopen_comment(
                kind.id, github.issue_closed_by(kind.github_id))
            if body:
                github.respond(kind.github_id, body)
    url = "https://github.com/{}/issues/{}".format(
        config.get("github_project"), kind.github_id)
    return {
        "text":
        "Thanks for reporting this issue! You can track further progress on GitHub.",
        "status": "reported",
        "location": url
    }