comparison src/memory/memory.py @ 866:f27d736428f1

core (memory): added 'no' value management in configuration's booleans
author Goffi <goffi@goffi.org>
date Tue, 25 Feb 2014 23:03:13 +0100
parents c2f6ada7858f
children 308a96bc7c1b
comparison
equal deleted inserted replaced
865:3ee2ec7ec010 866:f27d736428f1
407 @param attr: name of the attribute to get (e.g.: 'value' or 'type') 407 @param attr: name of the attribute to get (e.g.: 'value' or 'type')
408 @param value: user defined value""" 408 @param value: user defined value"""
409 if attr == 'value': 409 if attr == 'value':
410 value_to_use = value if value is not None else node.getAttribute(attr) # we use value (user defined) if it exist, else we use node's default value 410 value_to_use = value if value is not None else node.getAttribute(attr) # we use value (user defined) if it exist, else we use node's default value
411 if node.getAttribute('type') == 'bool': 411 if node.getAttribute('type') == 'bool':
412 return value_to_use.lower() not in ('false', '0') 412 return value_to_use.lower() not in ('false', '0', 'no')
413 return value_to_use 413 return value_to_use
414 return node.getAttribute(attr) 414 return node.getAttribute(attr)
415 415
416 def __type_to_string(self, result): 416 def __type_to_string(self, result):
417 """ convert result to string, according to its type """ 417 """ convert result to string, according to its type """