Example #1
0
def PlantMin(microWebSrv2, request) :
    try:
        plants = water.get_plant_objects()
        plant = plants['3']
        plant.update_min()
        water.write_plant_profiles()
    except :
        request.Response.ReturnBadRequest()
        return
    request.Response.ReturnRedirect('/saved')
Example #2
0
def RequestTestPost(microWebSrv2, request) :
    data = request.GetPostedURLEncodedForm()
    plants = water.get_plant_objects()
    try:
        moisture_percent_0 = float(data['moisture_percent_0']) / 100
        moisture_percent_1 = float(data['moisture_percent_1']) / 100
        moisture_percent_2 = float(data['moisture_percent_2']) / 100
        moisture_percent_3 = float(data['moisture_percent_3']) / 100
        plants['0'].update_desired_moisture_percent(moisture_percent_0)
        plants['1'].update_desired_moisture_percent(moisture_percent_1)
        plants['2'].update_desired_moisture_percent(moisture_percent_2)
        plants['3'].update_desired_moisture_percent(moisture_percent_3)
        plants['0'].update_name(data['plant_0_name'])
        plants['1'].update_name(data['plant_1_name'])
        plants['2'].update_name(data['plant_2_name'])
        plants['3'].update_name(data['plant_3_name'])
        water.write_plant_profiles()
    except :
        request.Response.ReturnBadRequest()
        return
    request.Response.ReturnRedirect('/saved')