objdictgen/eds_utils.py
changeset 206 6787754b251b
parent 205 dac0f9b4e3f8
child 226 abf63d732a84
equal deleted inserted replaced
205:dac0f9b4e3f8 206:6787754b251b
    46 
    46 
    47 # Dictionary for quickly translate eds access value into canfestival access value
    47 # Dictionary for quickly translate eds access value into canfestival access value
    48 ACCESS_TRANSLATE = {"ro" : "ro", "wo" : "wo", "rw" : "rw", "rwr" : "rw", "rww" : "rw", "const" : "ro"}
    48 ACCESS_TRANSLATE = {"ro" : "ro", "wo" : "wo", "rw" : "rw", "rwr" : "rw", "rww" : "rw", "const" : "ro"}
    49 
    49 
    50 # Function for verifying data values
    50 # Function for verifying data values
    51 is_integer = lambda x: type(x) == IntType
    51 is_integer = lambda x: type(x) in (IntType, LongType)
    52 is_string = lambda x: type(x) == StringType
    52 is_string = lambda x: type(x) in (StringType, UnicodeType)
    53 is_boolean = lambda x: x in (0, 1)
    53 is_boolean = lambda x: x in (0, 1)
    54 
    54 
    55 # Define checking of value for each attribute
    55 # Define checking of value for each attribute
    56 ENTRY_ATTRIBUTES = {"SUBNUMBER" : is_integer, "PARAMETERNAME" : is_string, 
    56 ENTRY_ATTRIBUTES = {"SUBNUMBER" : is_integer, "PARAMETERNAME" : is_string, 
    57                     "OBJECTTYPE" : lambda x: x in (7, 8, 9), "DATATYPE" : is_integer, 
    57                     "OBJECTTYPE" : lambda x: x in (7, 8, 9), "DATATYPE" : is_integer,