#NEWLINE# def _load( self ) : #NEWLINE# #INDENT# '\n        Load editable settings from the database and return them as a dict.\n        Delete any settings from the database that are no longer registered,\n        and emit a warning if there are settings that are defined in both\n        settings.py and the database.\n        ' #NEWLINE# from mezzanine.conf.models import Setting #NEWLINE# removed_settings = [ ] #NEWLINE# conflicting_settings = [ ] #NEWLINE# new_cache = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for setting_obj in Setting . objects . all ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# setting = registry [ setting_obj . name ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# removed_settings . append ( setting_obj . name ) #NEWLINE# continue #NEWLINE# #UNINDENT# setting_value = self . _to_python ( setting , setting_obj . value ) #NEWLINE# if hasattr ( django_settings , setting [ 'name' ] ) : #NEWLINE# #INDENT# if ( setting != setting [ 'default' ] ) : #NEWLINE# #INDENT# conflicting_settings . append ( setting_obj . name ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# new_cache [ setting [ 'name' ] ] = setting_value #NEWLINE# #UNINDENT# if removed_settings : #NEWLINE# #INDENT# Setting . objects . filter ( name__in = removed_settings ) . delete ( ) #NEWLINE# #UNINDENT# if conflicting_settings : #NEWLINE# #INDENT# warn ( ( 'These settings are defined in both settings.py and the database: %s. The settings.py values will be used.' % ', ' . join ( conflicting_settings ) ) ) #NEWLINE# #UNINDENT# return new_cache