Example #1
0
def validresult(upload):
    res = SuryaIANAResult.objects(item=upload)
    if res == None or len(res) == 0:
        return ''
    warn, warnmsg = Validate.validate(res[0])
    if warn == True:
        return ''
    elif warn == False:
        return 'Yes'
    else:
        return 'Unknwn'
Example #2
0
def oneoffresult(request, objID=None):
    if objID is None:
        return HttpResponseNotFound('<h1>File not found</h1>')

    try:
        result = SuryaIANAResult.objects.with_id(objID)
    except ValidationError:
        return HttpResponseNotFound('<h1>File not found</h1>')
    
    warn, warnmsg = Validate.validate(result)

    t = loader.get_template('result.html')
    c = RequestContext(request, {'result' : result, 'warnmsg': warnmsg})
    
    return HttpResponse(t.render(c))
Example #3
0
def view_upload(request, deploymentId, objId):
    if not request.user.is_superuser:
        u = MyUser.objects.get(id=request.user.id)
        if deploymentId not in u.deployment_list():
            return HttpResponseRedirect(reverse('SuryaWebPortal.views.home.home'))
    
    upload = SuryaUploadData.objects.with_id(objId)
    flowratestr = "cc/m"
    warn = None
    warnmsg = ""
    try:
        result = SuryaIANAResult.objects.get(item=upload)
        if result.computationConfiguration.airFlowRate < 20:
            flowratestr = "l/m"
        warn, warnmsg = Validate.validate(result)
    except SuryaIANAResult.DoesNotExist:
        try:
            result = SuryaIANAFailedResult.objects.get(item=upload)
        except SuryaIANAFailedResult.DoesNotExist:
            result = None
    t = loader.get_template('debug/view_upload.html')
    c = RequestContext(request, {'up':upload, 'dep_id':deploymentId, 'result':result, 'item':result, 'flowratestr':flowratestr, 'warn': warn, 'warnmsg': warnmsg})
    return HttpResponse(t.render(c))