libreoffice calc python macro data validity list and if statement

I don’t know how to over came this problem the validity list doesn’t put the list in the drop down to choose.
The code is this:

#!/usr/bin/python3
#-*-coding:utf8-*-

import uno

def CalcExamples():
        desktop=XSCRIPTCONTEXT.getDesktop()
        model=desktop.getCurrentComponent()
        if not hasattr(model, "Sheets"):
            model=desktop.loadComponentFromURL("private:factory/scalc", "_blank",
             0, ())
        sheets=model.Sheets.getByIndex(0)
        #Validity list
        dv_list1 = sheets.getCellRangeByName("B2")
        oValidation1 = dv_list.Validation
        oValidation1.Type = "LIST"
        oValidation1.setFormula1('"PEAD";"PEX"')
        dv_list1.Validation = oValidation1
        #Choose diferences from PEAD and PEX
        dv_list2 = sheets.getCellRangeByName("C2")
        oValidation2 = dv_list.Validation
        oValidation2.Type = "LIST"
        oValidation2.setFormula1('=IF($Sheets.$B$2="PEAD";"1,0 MPa";IF($Sheets.$B$2="PEX";'"1,25 MPa";"2,0 MPa"';"Escolha!"))')
        dv_list2.Validation = oValidation2
        #I've tried this as well
        #oValidation2.setFormula1('=IF($Sheets.$B$2="PEAD";"1,0 MPa";IF($Sheets.$B$2="PEX";{"1,25 MPa";"2,0 MPa"};"Escolha!"))')
        return None

g_exportedScripts = CalcExamples,

Property Type is Enum not String

from com.sun.star.sheet.ValidationType import LIST

def main():
    doc = XSCRIPTCONTEXT.getDocument()
    cell = doc.Sheets[0]['B2']
    v = cell.Validation
    v.Type = LIST
    v.Formula1 = '"ONE";"TWO"'
    cell.Validation = v
    return

The erro is in the IF statement because of the single quotes - oValidation2.setFormula1(’=IF($Sheets.$B$2=“PEAD”;“1,0 MPa”;IF($Sheets.$B$2=“PEX”;’“1,25 MPa”;“2,0 MPa”’;“Escolha!”))’) - I solved it wih the .format(lista), made a list called lista like this - lista=’{“1,25 MPa”;“2,0 MPa”}’ - and now works.

#!/usr/bin/python3
#--coding:utf8--

import uno

def CalcExamples():
desktop=XSCRIPTCONTEXT.getDesktop()
model=desktop.getCurrentComponent()
if not hasattr(model, “Sheets”):
model=desktop.loadComponentFromURL(“private:factory/scalc”, “_blank”,
0, ())
sheets=model.Sheets.getByIndex(0)
#Validity list
dv_list1 = sheets.getCellRangeByName(“B2”)
oValidation1 = dv_list.Validation
oValidation1.Type = “LIST”
oValidation1.setFormula1(’“PEAD”;“PEX”’)
dv_list1.Validation = oValidation1
#Choose diferences from PEAD and PEX
dv_list2 = sheets.getCellRangeByName(“C2”)
oValidation2 = dv_list2.Validation
oValidation2.Type = “LIST”
lista=’{“1,25 MPa”;“2,0 MPa”}’
oValidation2.setFormula1(’=IF($Sheets.$B$2=“PEAD”;“1,0 MPa”;IF($Sheets.$B$2=“PEX”;{0};“Escolha!”))’.format(lista))
dv_list2.Validation = oValidation2
return None

g_exportedScripts = CalcExamples,

Thanks for the tip by saying that this is a ENUM and not a string, that made me think and i found a solution, maybe not the best but it works.