def createExternalBug(request, crashid): entry = get_object_or_404(CrashEntry, pk=crashid) check_authorized_for_crash_entry(request, entry) if not entry.bucket: return renderError(request, "Cannot create an external bug for an issue that is not associated to a bucket/signature") if request.method == 'POST': provider = get_object_or_404(BugProvider, pk=request.POST['provider']) # Let the provider handle the POST request, which will file the bug # and return us the external bug ID extBugId = provider.getInstance().handlePOSTCreate(request, entry) # Now create a bug in our database with that ID and assign it to the bucket extBug = Bug(externalId=extBugId, externalType=provider) extBug.save() entry.bucket.bug = extBug entry.bucket.save() return redirect('crashmanager:sigview', sigid=entry.bucket.pk) elif request.method == 'GET': if 'provider' in request.GET: provider = get_object_or_404(BugProvider, pk=request.GET['provider']) else: user = User.get_or_create_restricted(request.user)[0] provider = get_object_or_404(BugProvider, pk=user.defaultProviderId) return provider.getInstance().renderContextCreate(request, entry) else: raise SuspiciousOperation
def linkSignature(request, sigid): bucket = get_object_or_404(Bucket, pk=sigid) check_authorized_for_signature(request, bucket) providers = BugProvider.objects.all() data = {'bucket': bucket, 'providers': providers} if request.method == 'POST': provider = get_object_or_404(BugProvider, pk=request.POST['provider']) bugId = request.POST['bugId'] username = request.POST['username'] password = request.POST['password'] bug = Bug.objects.filter(externalId=bugId, externalType=provider) if 'submit_save' in request.POST: if not bug: bug = Bug(externalId=bugId, externalType=provider) bug.save() else: bug = bug[0] bucket.bug = bug bucket.save() return redirect('crashmanager:sigview', sigid=bucket.pk) else: # This is a preview request bugData = provider.getInstance().getBugData( bugId, username, password) if bugData == None: data['error_message'] = 'Bug not found in external database.' else: data['summary'] = bugData['summary'] data['provider'] = provider data['bugId'] = bugId data['username'] = username return render(request, 'signatures/link.html', data) elif request.method == 'GET': return render(request, 'signatures/link.html', data) else: raise SuspiciousOperation
def linkSignature(request, sigid): bucket = get_object_or_404(Bucket, pk=sigid) check_authorized_for_signature(request, bucket) providers = BugProvider.objects.all() data = { 'bucket' : bucket, 'providers' : providers } if request.method == 'POST': provider = get_object_or_404(BugProvider, pk=request.POST['provider']) bugId = request.POST['bugId'] username = request.POST['username'] password = request.POST['password'] bug = Bug.objects.filter(externalId=bugId, externalType=provider) if 'submit_save' in request.POST: if not bug: bug = Bug(externalId=bugId, externalType=provider) bug.save() else: bug = bug[0] bucket.bug = bug bucket.save() return redirect('crashmanager:sigview', sigid=bucket.pk) else: # This is a preview request bugData = provider.getInstance().getBugData(bugId, username, password) if bugData == None: data['error_message'] = 'Bug not found in external database.' else: data['summary'] = bugData['summary'] data['provider'] = provider data['bugId'] = bugId data['username'] = username return render(request, 'signatures/link.html', data) elif request.method == 'GET': return render(request, 'signatures/link.html', data) else: raise SuspiciousOperation
def linkSignature(request, sigid): bucket = get_object_or_404(Bucket, pk=sigid) providers = BugProvider.objects.all() data = {"bucket": bucket, "providers": providers} if request.method == "POST": provider = get_object_or_404(BugProvider, pk=request.POST["provider"]) bugId = request.POST["bugId"] username = request.POST["username"] password = request.POST["password"] bug = Bug.objects.filter(externalId=bugId, externalType=provider) if "submit_save" in request.POST: if not bug: bug = Bug(externalId=bugId, externalType=provider) bug.save() else: bug = bug[0] bucket.bug = bug bucket.save() return redirect("crashmanager:sigview", sigid=bucket.pk) else: # This is a preview request bugData = provider.getInstance().getBugData(bugId, username, password) if bugData == None: data["error_message"] = "Bug not found in external database." else: data["summary"] = bugData["summary"] data["provider"] = provider data["bugId"] = bugId data["username"] = username return render(request, "signatures/link.html", data) elif request.method == "GET": return render(request, "signatures/link.html", data) else: raise SuspiciousOperation