def _load(self):
        """
        Load editable settings from the database and return them as a dict.
        Delete any settings from the database that are no longer registered,
        and emit a warning if there are settings that are defined in both
        settings.py and the database.
        """
        from mezzanine.conf.models import Setting

        removed_settings = []
        conflicting_settings = []
        new_cache = {}

        for setting_obj in Setting.objects.all():

            # Check that the Setting object corresponds to a setting that has
            # been declared in code using ``register_setting()``. If not, add
            # it to a list of items to be deleted from the database later.
            try:
                setting = registry[setting_obj.name]
            except __HOLE__:
                removed_settings.append(setting_obj.name)
                continue

            # Convert a string from the database to the correct Python type.
            setting_value = self._to_python(setting, setting_obj.value)

            # If a setting is defined both in the database and in settings.py,
            # raise a warning and use the value defined in settings.py.
            if hasattr(django_settings, setting["name"]):
                if setting_value != setting["default"]:
                    conflicting_settings.append(setting_obj.name)
                    continue

            # If nothing went wrong, use the value from the database!
            new_cache[setting["name"]] = setting_value

        if removed_settings:
            Setting.objects.filter(name__in=removed_settings).delete()

        if conflicting_settings:
            warn("These settings are defined in both settings.py and "
                 "the database: %s. The settings.py values will be used."
                 % ", ".join(conflicting_settings))

        return new_cache
dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/conf/__init__.py/Settings._load