Beispiel #1
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
Beispiel #2
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