print "Content-type: text/html\n"

form = cgi.FieldStorage()
person_id = base.cleanCGInumber(form.getvalue("person_id"))
test_type = base.cleanCGInumber(form.getvalue("test_type"))
serial_num = base.cleanCGInumber(form.getvalue("serial_number"))
success = base.cleanCGInumber(form.getvalue("success"))
comments = form.getvalue("comments")

if comments:
    comments = cgi.escape(comments)

base.header(title='Add Test')
base.top()

test_id = add_test_functions.add_test(person_id, test_type, serial_num,
                                      success, comments)

for itest in (1, 2, 3):
    afile = form['attach%d' % (itest)]
    if (afile.filename):
        adesc = form.getvalue("attachdesc%d" % (itest))
        if adesc:
            adesc = cgi.escape(adesc)
        acomment = form.getvalue("attachcomment%d" % (itest))
        if acomment:
            acomment = cgi.escape(acomment)
        add_test_functions.add_test_attachment(test_id, afile, adesc, acomment)

base.bottom()
test_id=add_test_functions.add_test(person_id, test_type, serial_num, success, new_comments, vals)

itest = 1
afile = form['attach%d'%(itest)]
if (afile.filename):
    adesc= form.getvalue("attachdesc%d"%(itest))
    if adesc:
        adesc = cgi.escape(adesc)
        brokendesc = adesc.split(breakoff)
        new_adesc=""
        for line in brokendesc:
           new_adesc = new_adesc + "<p>" + line + "</p>"
    else:
        new_adesc = adesc
    add_test_functions.add_test_attachment(test_id,afile,new_adesc)

#for itest in (1,2,3):
#    afile = form['attach%d'%(itest)]
#    if (afile.filename):
#        adesc= form.getvalue("attachdesc%d"%(itest))
#        if adesc:
#            adesc = cgi.escape(adesc)
#        acomment= form.getvalue("attachcomment%d"%(itest))
#        if acomment:
#            acomment = cgi.escape(acomment)
#        add_test_functions.add_test_attachment(test_id,afile,adesc)#,acomment)
    

#base.bottom()
Exemple #3
0
print "Content-type: text/html\n"

form = cgi.FieldStorage()
person_id = base.cleanCGInumber(form.getvalue("person_id"))
test_type = base.cleanCGInumber(form.getvalue("test_type"))
serial_num = base.cleanCGInumber(form.getvalue("serial_number"))
success = base.cleanCGInumber(form.getvalue("success"))
comments = form.getvalue("comments")

if comments:
    comments = cgi.escape(comments)

base.header(title="Add Test")
base.top()

test_id = add_test_functions.add_test(person_id, test_type, serial_num, success, comments)

for itest in (1, 2, 3):
    afile = form["attach%d" % (itest)]
    if afile.filename:
        adesc = form.getvalue("attachdesc%d" % (itest))
        if adesc:
            adesc = cgi.escape(adesc)
        acomment = form.getvalue("attachcomment%d" % (itest))
        if acomment:
            acomment = cgi.escape(acomment)
        add_test_functions.add_test_attachment(test_id, afile, adesc, acomment)


base.bottom()
test_id = add_test_functions.add_test(person_id, test_type, serial_num,
                                      success, new_comments, vals)

itest = 1
afile = form['attach%d' % (itest)]
if (afile.filename):
    adesc = form.getvalue("attachdesc%d" % (itest))
    if adesc:
        adesc = cgi.escape(adesc)
        brokendesc = adesc.split(breakoff)
        new_adesc = ""
        for line in brokendesc:
            new_adesc = new_adesc + "<p>" + line + "</p>"
    else:
        new_adesc = adesc
    add_test_functions.add_test_attachment(test_id, afile, new_adesc)

#for itest in (1,2,3):
#    afile = form['attach%d'%(itest)]
#    if (afile.filename):
#        adesc= form.getvalue("attachdesc%d"%(itest))
#        if adesc:
#            adesc = cgi.escape(adesc)
#        acomment= form.getvalue("attachcomment%d"%(itest))
#        if acomment:
#            acomment = cgi.escape(acomment)
#        add_test_functions.add_test_attachment(test_id,afile,adesc)#,acomment)

#base.bottom()