320 # verify that there is no whitespace into keyname |
320 # verify that there is no whitespace into keyname |
321 if keyname.isalnum(): |
321 if keyname.isalnum(): |
322 # value can be preceded and followed by whitespaces, so we escape them |
322 # value can be preceded and followed by whitespaces, so we escape them |
323 value = value.strip() |
323 value = value.strip() |
324 # First case, value starts with "$NODEID", then it's a formula |
324 # First case, value starts with "$NODEID", then it's a formula |
325 if value.startswith("$NODEID"): |
325 if value.upper().startswith("$NODEID"): |
326 try: |
326 try: |
327 test = int(value.replace("$NODEID+", ""), 16) |
327 test = int(value.upper().replace("$NODEID+", ""), 16) |
328 computed_value = "\"%s\""%value |
328 computed_value = "\"%s\""%value |
329 except: |
329 except: |
330 raise SyntaxError, "\"%s\" is not a valid formula for attribute \"%s\" of section \"[%s]\""%(value, keyname, section_name) |
330 raise SyntaxError, "\"%s\" is not a valid formula for attribute \"%s\" of section \"[%s]\""%(value, keyname, section_name) |
331 # Second case, value starts with "0x", then it's an hexadecimal value |
331 # Second case, value starts with "0x", then it's an hexadecimal value |
332 elif value.startswith("0x") or value.startswith("-0x"): |
332 elif value.startswith("0x") or value.startswith("-0x"): |