@classmethod
    def _to_python(cls, setting, raw_value):
        """
        Convert a value stored in the database for a particular setting
        to its correct type, as determined by ``register_setting()``.
        """

        type_fn = cls.TYPE_FUNCTIONS.get(setting["type"], setting["type"])

        try:
            value = type_fn(raw_value)
        except __HOLE__:
            # Shouldn't occur, but just a safeguard in case
            # the db value somehow ended up as an invalid type.
            warn("The setting %s should be of type %s, but the value "
                 "retrieved from the database (%s) could not be converted. "
                 "Using the default instead: %s"
                 % (setting["name"], setting["type"].__name__,
                    repr(raw_value), repr(setting["default"])))
            value = setting["default"]

        return value
dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/conf/__init__.py/Settings._to_python