(self, header, userSettings, subHeader)
Adds information about the user's settings to the xml.
        The information can be user's passwords, privileges and etc..
Adds information about the user's settings to the xml.
        The information can be user's passwords, privileges and etc..
Adds information about the user s settings to the xml . The information can be user s passwords privileges and etc ..
def userSettings(self, header, userSettings, subHeader):
        '''
        Adds information about the user's settings to the xml.
        The information can be user's passwords, privileges and etc..
        '''
        self._areAdmins = set()
        userSettingsElem = self._getRootChild(USER_SETTINGS_ELEM_NAME)
        if (not(userSettingsElem)):
            userSettingsElem = self.__doc.createElement(USER_SETTINGS_ELEM_NAME)
            self._addToRoot(userSettingsElem)

        userSettingElem = self.__doc.createElement(USER_SETTING_ELEM_NAME)
        userSettingElem.setAttributeNode(self._createAttribute(TYPE_ATTR, header))

        if isinstance(userSettings, (tuple, list, set)):
            self._areAdmins = userSettings[1]
            userSettings = userSettings[0]

        users = userSettings.keys()
        users.sort(key=lambda x: x.lower())

        for user in users:
            userElem = self.__doc.createElement(USER_ELEM_NAME)
            userSettingElem.appendChild(userElem)
            if user in self._areAdmins:
                userElem.setAttributeNode(self._createAttribute(TYPE_ATTR, ADMIN_USER))
            else:
                userElem.setAttributeNode(self._createAttribute(TYPE_ATTR, REGULAR_USER))

            settings = userSettings[user]

            settings.sort()

            for setting in settings:
                settingsElem = self.__doc.createElement(SETTINGS_ELEM_NAME)
                settingsElem.setAttributeNode(self._createAttribute(TYPE_ATTR, subHeader))
                settingTextNode = self._createTextNode(setting)
                settingsElem.appendChild(settingTextNode)
                userElem.appendChild(settingsElem)
        userSettingsElem.appendChild(userSettingElem)
def userSettings ( self , header , userSettings , subHeader ) : self . _areAdmins = set ( ) userSettingsElem = self . _getRootChild ( USER_SETTINGS_ELEM_NAME ) if ( not ( userSettingsElem ) ) : userSettingsElem = self . __doc . createElement ( USER_SETTINGS_ELEM_NAME ) self . _addToRoot ( userSettingsElem ) userSettingElem = self . __doc . createElement ( USER_SETTING_ELEM_NAME ) userSettingElem . setAttributeNode ( self . _createAttribute ( TYPE_ATTR , header ) ) if isinstance ( userSettings , ( tuple , list , set ) ) : self . _areAdmins = userSettings [ 1 ] userSettings = userSettings [ 0 ] users = userSettings . keys ( ) users . sort ( key = lambda x : x . lower ( ) ) for user in users : userElem = self . __doc . createElement ( USER_ELEM_NAME ) userSettingElem . appendChild ( userElem ) if user in self . _areAdmins : userElem . setAttributeNode ( self . _createAttribute ( TYPE_ATTR , ADMIN_USER ) ) else : userElem . setAttributeNode ( self . _createAttribute ( TYPE_ATTR , REGULAR_USER ) ) settings = userSettings [ user ] settings . sort ( ) for setting in settings : settingsElem = self . __doc . createElement ( SETTINGS_ELEM_NAME ) settingsElem . setAttributeNode ( self . _createAttribute ( TYPE_ATTR , subHeader ) ) settingTextNode = self . _createTextNode ( setting ) settingsElem . appendChild ( settingTextNode ) userElem . appendChild ( settingsElem ) userSettingsElem . appendChild ( userSettingElem )