(self, settings)
Update the settings

        If a derived class has an ALLOWED_SETTINGS dict, we check here that
        incoming settings from the web app are allowed, and set the child
        properties as appropriate.
Update the settings
Update the settings
def update_settings(self, settings):
        """Update the settings

        If a derived class has an ALLOWED_SETTINGS dict, we check here that
        incoming settings from the web app are allowed, and set the child
        properties as appropriate.

        """

        def error_string(setting, setting_val):
            return ('{val} is not an acceptable value for '
                    'parameter {param} for visualization'
                    '{vis}.').format(val=setting_val,
                                     param=setting,
                                     vis=self.__class__.__name__)

        for setting in settings:
            if settings[setting] in self.ALLOWED_SETTINGS[setting]:
                # if the setting is allowed, set the attribute but remove
                # invalid variable characters
                #
                # see:
                #
                # https://stackoverflow.com/questions/3303312/how-do-i-convert-a-string-to-a-valid-variable-name-in-python
                setattr(self, '_' + re.sub('\W|^(?=\d)', '_', setting).lower(),
                        settings[setting])
            else:
                raise ValueError(error_string(settings[setting], setting))
def update_settings ( self , settings ) : def error_string ( setting , setting_val ) : return ( '{val} is not an acceptable value for ' 'parameter {param} for visualization' '{vis}.' ) . format ( val = setting_val , param = setting , vis = self . __class__ . __name__ ) for setting in settings : if settings [ setting ] in self . ALLOWED_SETTINGS [ setting ] : # if the setting is allowed, set the attribute but remove # invalid variable characters # # see: # # https://stackoverflow.com/questions/3303312/how-do-i-convert-a-string-to-a-valid-variable-name-in-python setattr ( self , '_' + re . sub ( '\W|^(?=\d)' , '_' , setting ) . lower ( ) , settings [ setting ] ) else : raise ValueError ( error_string ( settings [ setting ] , setting ) )