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 post(self): form = cgi.FieldStorage() logger.info(form) thefile = form['file-0'] iter_html=loop_html(thefile) templatepath = os.path.dirname(__file__) + '/../templates/' ChkCookie = self.request.cookies.get("ubercookie") # html = uber_lib.SkinChk(ChkCookie) # html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'rice','page':'batchinput'}) # html = html + template.render (templatepath + '03ubertext_links_left.html', {}) html = template.render(templatepath + '04uberbatch_start.html', { 'model':'rice', 'model_attributes':'Rice Model Batch Output'}) html = html + rice_tables.timestamp() html = html + iter_html html = html + template.render(templatepath + 'rice-batchoutput-jqplot.html', {}) html = html + template.render(templatepath + 'export.html', {}) html = html + template.render(templatepath + '04uberoutput_end.html', {'sub_title': ''}) # html = html + template.render(templatepath + '06uberfooter.html', {'links': ''}) self.response.out.write(html)
def get(self): templatepath = os.path.dirname(__file__) + '/../templates/' ChkCookie = self.request.cookies.get("ubercookie") html = uber_lib.SkinChk(ChkCookie, "Rice QA/QC") html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'rice','page':'qaqc'}) html = html + template.render (templatepath + '03ubertext_links_left.html', {}) html = html + template.render(templatepath + '04uberoutput_start.html', { 'model':'rice', 'model_attributes':'Rice Model QAQC'}) html = html + rice_tables.timestamp() html = html + rice_tables.table_all_qaqc(rice_obj) # html = html + """ # <table border="1"> # <tr><H3>Model Validation Inputs</H3></tr><br> # <tr> # <td>Input Name</td> # <td>Test value1</td> # <td>Test value2</td> # <td>Unit</td> # </tr> # <tr> # <td>Mass of Applied Ingredient Applied to Paddy</td> # <td>%s</td> # <td>%s</td> # <td>kg</td> # </tr> # <tr> # <td>Sediment Depth</td> # <td>%s</td> # <td>%s</td> # <td>m</td> # </tr> # <tr> # <td>Area of the Rice Paddy</td> # <td>%s</td> # <td>%s</td> # <td>m<sup>2</sup></td> # </tr> # <tr> # <td>Bulk Density of Sediment</td> # <td>%s</td> # <td>%s</td> # <td>kg/m<sup>3</sup></td> # </tr> # <tr> # <td>Water Column Depth</td> # <td>%s</td> # <td>%s</td> # <td>m</td> # </tr> # <tr> # <td>Porosity of Sediment</td> # <td>%s</td> # <td>%s</td> # <td>-</td> # </tr> # <tr> # <td>Water-Sediment Partitioning Coefficient</td> # <td>%s</td> # <td>%s</td> # <td>L/kg</td> # </table> # """ % (mai[0], mai[1], dsed[0], dsed[1], a[0], a[1], # pb[0], pb[1], dw[0], dw[1], osed[0], osed[1], kd[0], kd[1]) # html = html + """ # <table width="500" border="1"> # <br> # <tr><H3>Model Validation Outputs<H3></tr><br> # <tr> # <td>Model Name</td> # <td>Simulated value</td> # <td>Expected value</td> # <td>Test output</td> # </tr> # <tr> # <td>Msed</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # <tr> # <td>Msed</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # <tr> # <td>Vw</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # <tr> # <td>Vw</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # <tr> # <td>Mai1</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # <tr> # <td>Mai1</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # <tr> # <td>Cw</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # <tr> # <td>Cw</td> # <td>%s</td> # <td>%s</td> # <td><div style="word-wrap: break-word; width:40em">%s</div></td> # </tr> # </table> # """ % (out_fun_Msed[0],msed_out[0],test_suite_msed_1, # out_fun_Msed[1],msed_out[1],test_suite_msed_2, # out_fun_Vw[0],vw_out[0],test_suite_vw_1, # out_fun_Vw[1],vw_out[1],test_suite_vw_2, # out_fun_Mai1[0],mai1_out[0],test_suite_mai1_1, # out_fun_Mai1[1],mai1_out[1],test_suite_mai1_2, # out_fun_Cw[0],cw_out[0],test_suite_cw_1, # out_fun_Cw[1],cw_out[1],test_suite_cw_2) html = html + template.render(templatepath + 'export.html', {}) html = html + template.render(templatepath + '04uberoutput_end.html', {'sub_title': ''}) html = html + template.render(templatepath + '06uberfooter.html', {'links': ''}) self.response.out.write(html)