def post(self): # logger = logging.getLogger("UbertoolUseConfigurationPage") form = cgi.FieldStorage() # config_name = str(form.getvalue('config_name')) # user = users.get_current_user() # if user: # logger.info(user.user_id()) # rice.user = user # rice.config_name = config_name chemical_name = form.getvalue('chemical_name') mai = form.getvalue('mai') dsed = form.getvalue('dsed') a = form.getvalue('area') pb = form.getvalue('pb') dw = form.getvalue('dw') osed = form.getvalue('osed') kd = form.getvalue('Kd') rice_obj = rice_model.rice(True,True,chemical_name, mai, dsed, a, pb, dw, osed, kd) # rice.put() # q = db.Query(rice_model.Rice) # q.filter("user ="******"config_name =", config_name) # for new_use in q: # logger.info(new_use.to_xml()) text_file = open('rice/rice_description.txt','r') x = text_file.read() templatepath = os.path.dirname(__file__) + '/../templates/' ChkCookie = self.request.cookies.get("ubercookie") html = uber_lib.SkinChk(ChkCookie, "Rice Output") html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'rice','page':'output'}) html = html + template.render (templatepath + '03ubertext_links_left.html', {}) html = html + template.render(templatepath + '04uberoutput_start.html',{ 'model':'rice', 'model_attributes':'Rice Model Output'}) html = html + rice_tables.timestamp() html = html + rice_tables.table_all(rice_obj) html = html + template.render(templatepath + 'export.html', {}) html = html + template.render(templatepath + '04uberoutput_end.html', {}) html = html + template.render(templatepath + '06uberfooter.html', {'links': ''}) self.response.out.write(html)
def html_table(row_inp,iter): logger.info("iteration: " + str(iter)) chemical_name.append(str(row_inp[0])) mai.append(float(row_inp[1])) a.append(float(row_inp[2])) dsed.append(float(row_inp[3])) pb.append(float(row_inp[4])) dw.append(float(row_inp[5])) osed.append(float(row_inp[6])) kd.append(float(row_inp[7])) # msed.append(float(row_inp[8])) # vw.append(float(row_inp[9])) # mai1.append(float(row_inp[10])) # cw.append(float(row_inp[11])) logger.info(chemical_name) logger.info(mai) logger.info(a) logger.info(dsed) logger.info(pb) logger.info(dw) logger.info(osed) logger.info(kd) logger.info(msed) logger.info(vw) logger.info(mai1) logger.info(cw) rice_obj = rice_model.rice(True,True,chemical_name[iter], mai[iter], dsed[iter], a[iter], pb[iter], dw[iter], osed[iter], kd[iter]) msed.append(rice_obj.msed) vw.append(rice_obj.vw) mai1.append(rice_obj.mai1) cw.append(rice_obj.cw) html = rice_tables.table_all(rice_obj) return html
# out_fun_Cw.append(fun) # testFailureMessage = "Test of function name: %s expected: %d != calculated: %d" % ("cw",self.cw_out_in,fun) # self.assertEqual(round(fun,3),round(self.cw_out_in,3),testFailureMessage) # def suite(TestCaseName, **kwargs): # suite = unittest.TestSuite() # set_globals(**kwargs) # suite.addTest(unittest.makeSuite(TestCaseName)) # stream = StringIO() # runner = unittest.TextTestRunner(stream=stream, verbosity=2) # result = runner.run(suite) # stream.seek(0) # test_out=stream.read() # return test_out rice_obj = rice_model.rice(True,True,chemical_name[0], mai[0], dsed[0], a[0], pb[0], dw[0], osed[0], kd[0]) # rice_obj.set_unit_testing_variables() rice_obj.chemical_name_expected=chemical_name[0] rice_obj.msed_expected=msed[0] rice_obj.vw_expected=vw[0] rice_obj.mai1_expected=mai1[0] rice_obj.cw_expected=cw[0] # test_suite_msed_1 = suite(TestCase_Msed, dsed=dsed[0], a=a[0], pb=pb[0], msed_out=msed_out[0]) # test_suite_msed_2 = suite(TestCase_Msed, dsed=dsed[1], a=a[1], pb=pb[1], msed_out=msed_out[1]) # test_suite_vw_1 = suite(TestCase_Vw, dw=dw[0], a=a[0], dsed=dsed[0], osed=osed[0], vw_out=vw_out[0]) # test_suite_vw_2 = suite(TestCase_Vw, dw=dw[1], a=a[1], dsed=dsed[1], osed=osed[1], vw_out=vw_out[1]) # test_suite_mai1_1 = suite(TestCase_Mai1, mai=mai[0], a=a[0], mai1_out=mai1_out[0]) # test_suite_mai1_2 = suite(TestCase_Mai1, mai=mai[1], a=a[1], mai1_out=mai1_out[1]) # test_suite_cw_1 = suite(TestCase_Cw, mai=mai[0], a=a[0], dw=dw[0], dsed=dsed[0], osed=osed[0], pb=pb[0], kd=kd[0], cw_out=cw_out[0])