Пример #1
0
def importBSMXMashStep(data):
    mashStep = MashStep()
    mashStep.name = data.find('F_MS_NAME').text
    bsmx_step_type = {
        '0': model.constants.MASH_STEP_INFUSION,
        '1': model.constants.MASH_STEP_DECOCTION,
        '2': model.constants.MASH_STEP_TEMPERATURE
    }
    mashStep.type = bsmx_step_type.get(data.find('F_MS_TYPE').text, model.constants.MASH_STEP_INFUSION)
    mashStep.time = "%.0f" % float(data.find('F_MS_STEP_TIME').text)
    mashStep.temp = "%.1f" % farenheit_to_celsius(float(data.find('F_MS_STEP_TEMP').text))
    mashStep.infuseAmount = bsmx_volume_conversion(float(data.find('F_MS_TUN_VOL').text))
    return mashStep
Пример #2
0
def importBSMXMashStep(data):
    mashStep = MashStep()
    mashStep.name = data.find('F_MS_NAME').text
    bsmx_step_type = {
        '0': model.constants.MASH_STEP_INFUSION,
        '1': model.constants.MASH_STEP_DECOCTION,
        '2': model.constants.MASH_STEP_TEMPERATURE
    }
    mashStep.type = bsmx_step_type.get(
        data.find('F_MS_TYPE').text, model.constants.MASH_STEP_INFUSION)
    mashStep.time = "%.0f" % float(data.find('F_MS_STEP_TIME').text)
    mashStep.temp = "%.1f" % farenheit_to_celsius(
        float(data.find('F_MS_STEP_TEMP').text))
    mashStep.infuseAmount = bsmx_volume_conversion(
        float(data.find('F_MS_TUN_VOL').text))
    return mashStep
Пример #3
0
def importBeerXMLMashStep(data):
    mashStep = MashStep()

    for child in data:
        if 'NAME' == child.tag:
            mashStep.name = child.text
        if 'VERSION' == child.tag:
            mashStep.version = int(child.text)
        if 'TYPE' == child.tag:
            if 'Infusion' == child.text:
                mashStep.type = model.constants.MASH_STEP_INFUSION
            elif 'Temperature' == child.text:
                mashStep.type = model.constants.MASH_STEP_TEMPERATURE
            elif 'Decoction' == child.text:
                mashStep.type = model.constants.MASH_STEP_DECOCTION
        if 'STEP_TIME' == child.tag:
            mashStep.time = "%.0f" % float(child.text)
        if 'STEP_TEMP' == child.tag:
            mashStep.temp = "%.1f" % float(child.text)
        if 'INFUSE_AMOUNT' == child.tag:
            mashStep.infuseAmount = float(child.text)

    return mashStep
Пример #4
0
def importBeerXMLMashStep(data):
    mashStep = MashStep()

    for child in data:
        if 'NAME' == child.tag:
            mashStep.name = child.text
        if 'VERSION' == child.tag:
            mashStep.version = int(child.text)
        if 'TYPE' == child.tag:
            if 'Infusion' == child.text:
                mashStep.type = model.constants.MASH_STEP_INFUSION
            elif 'Temperature' == child.text:
                mashStep.type = model.constants.MASH_STEP_TEMPERATURE
            elif 'Decoction' == child.text:
                mashStep.type = model.constants.MASH_STEP_DECOCTION
        if 'STEP_TIME' == child.tag:
            mashStep.time = "%.0f" % float(child.text)
        if 'STEP_TEMP' == child.tag:
            mashStep.temp = "%.1f" % float(child.text)
        if 'INFUSE_AMOUNT' == child.tag:
            mashStep.infuseAmount = float(child.text)
    
    return mashStep