def load_time_zones(): time_zones = [] tree = open_xml_file(c.TIME_ZONES_FILE) if tree is not None: time_zones.append(['', '']) for child in tree.getroot(): time_zones.append([child.attrib.get('value'), child.attrib.get('label')]) return time_zones
def update_app_config_value(element_name, element_value): tree = open_xml_file(c.APP_CONFIG_FILE) if tree is not None: root = tree.getroot() for child in root: if child.tag == element_name: child.set('value', element_value) break tree.write(c.APP_CONFIG_FILE, encoding='utf-8', xml_declaration=True)
def load_app_config_languages(): tree = open_xml_file(c.APP_CONFIG_FILE) if tree is not None: global LANGUAGES LANGUAGES = [['en', 'English']] for child in tree.getroot(): if child.tag == 'languages': for lang in child: if lang.attrib.get('value') != 'en': LANGUAGES.append([lang.attrib.get('value'), lang.attrib.get('label')])