示例#1
0
    def post(self):
        form = cgi.FieldStorage()
        tier = form.getvalue('tier')
        ai_name = form.getvalue('ai_name')
        prod_re = form.getvalue('prod_re')
        ai = form.getvalue('ai')
        ai = float(ai)/100

        liq_rte = form.getvalue('liq_rte')
        liq_rte =float(liq_rte)/100
        fruit_rte = form.getvalue('fruit_rte')
        fruit_rte =float(fruit_rte)/100
        bread_rte = form.getvalue('bread_rte')
        bread_rte =float(bread_rte)/100
        cheese_rte = form.getvalue('cheese_rte')
        cheese_rte =float(cheese_rte)/100
        veg_rte = fruit_rte
        meat_rte = form.getvalue('meat_rte')
        meat_rte =float(meat_rte)/100
        pure_rte = form.getvalue('pure_rte')
        pure_rte =float(pure_rte)/100
        piec_rte = form.getvalue('piec_rte')
        piec_rte =float(piec_rte)/100
        powd_rte = bread_rte

        templatepath = os.path.dirname(__file__) + '/../templates/'
        html = template.render(templatepath + '01hh_uberheader.html', {'title':'Ubertool'})        
        html = html + template.render(templatepath + '02hh_uberintroblock_wmodellinks.html',  {'model':'idream','page':'output'})
        html = html + template.render (templatepath + '03hh_ubertext_links_left.html', {})                               
        html = html + template.render(templatepath + '04uberoutput_start.html', {
                'model':'idream', 
                'model_attributes':'IDREAM Output'})

        if tier == 'Tier 2':
            idream_obj = idream_model.idream(tier, ai_name, prod_re, ai)
        # print idream_obj.__dict__.items()
        else:
            idream_obj = idream_model.idream3(tier, ai_name, prod_re, ai, liq_rte, fruit_rte, bread_rte, cheese_rte, veg_rte, meat_rte, pure_rte, piec_rte, powd_rte)

        html = html + idream_tables.timestamp()
        html = html + idream_tables.table_all(idream_obj)

        html = html + template.render(templatepath + 'export.html', {})
        html = html + template.render(templatepath + '04uberoutput_end.html', {})
        html = html + template.render(templatepath + '06hh_uberfooter.html', {'links': ''})
        self.response.out.write(html)
示例#2
0
def html_table(row, iter):
    tire_temp = str(row[0])
    ai_name_temp = str(row[1])
    ai_name.append(ai_name_temp)
    prod_re_temp = float(row[2])
    prod_re.append(prod_re_temp)
    ai_temp = float(row[3])/100
    ai.append(ai_temp)

    if tire_temp == 'Tier 2':
        idream_obj_temp = idream_model.idream(tire_temp, ai_name_temp, prod_re_temp, ai_temp)
        liq_rte.append(1)
        fruit_rte.append(0.7)
        bread_rte.append(0.2)
        cheese_rte.append(0.55)
        veg_rte.append(0.7)
        meat_rte.append(0.8)
        pure_rte.append(1)
        piec_rte.append(0.55)
        powd_rte.append(0.2)

        exp_child_c_1_out.append(idream_obj_temp.exp_child_c_1)
        exp_child_c_2_out.append(idream_obj_temp.exp_child_c_2)
        exp_adult_c_out.append(idream_obj_temp.exp_adult_c)
        exp_fe_c_out.append(idream_obj_temp.exp_fe_c)
        exp_child_a_1_out.append(idream_obj_temp.exp_child_a_1)
        exp_child_a_2_out.append(idream_obj_temp.exp_child_a_2)
        exp_adult_a_out.append(idream_obj_temp.exp_adult_a)
        exp_fe_a_out.append(idream_obj_temp.exp_fe_a)

    else:
        liq_rte_temp = float(row[4])/100
        fruit_rte_temp = float(row[5])/100
        bread_rte_temp = float(row[6])/100
        cheese_rte_temp = float(row[7])/100
        veg_rte_temp = float(row[8])/100
        meat_rte_temp = float(row[9])/100
        pure_rte_temp = float(row[10])/100
        piec_rte_temp = float(row[11])/100
        powd_rte_temp = float(row[12])/100
        liq_rte.append(liq_rte_temp)
        fruit_rte.append(fruit_rte_temp)
        bread_rte.append(bread_rte_temp)
        cheese_rte.append(cheese_rte_temp)
        veg_rte.append(veg_rte_temp)
        meat_rte.append(meat_rte_temp)
        pure_rte.append(pure_rte_temp)
        piec_rte.append(piec_rte_temp)
        powd_rte.append(powd_rte_temp)
        
        idream_obj_temp = idream_model.idream3(tire_temp, ai_name_temp, prod_re_temp, ai_temp, liq_rte_temp, fruit_rte_temp, bread_rte_temp, cheese_rte_temp, veg_rte_temp, meat_rte_temp, pure_rte_temp, piec_rte_temp, powd_rte_temp)

        exp_child_c_1_out.append(idream_obj_temp.exp_child_c_1[0])
        exp_child_c_2_out.append(idream_obj_temp.exp_child_c_2[0])
        exp_adult_c_out.append(idream_obj_temp.exp_adult_c[0])
        exp_fe_c_out.append(idream_obj_temp.exp_fe_c[0])
        exp_child_a_1_out.append(idream_obj_temp.exp_child_a_1)
        exp_child_a_2_out.append(idream_obj_temp.exp_child_a_2)
        exp_adult_a_out.append(idream_obj_temp.exp_adult_a)
        exp_fe_a_out.append(idream_obj_temp.exp_fe_a)


    Input_header="""<br><H3 class="out_0 collapsible" id="section0"><span></span>Batch Calculation of Iteration %s</H3>
                        <div class="out_">
                 """%(iter)

    table_all_out = idream_tables.table_all(idream_obj_temp)
    html_table_temp = Input_header + table_all_out + "</div><br>"

    return html_table_temp