giraffez/config.py
def get_connection(self, dsn=None):
        """
        Retrieve a connection by the given :code:`dsn`, or the default connection.

        :param str dsn: The name of the connection to retrieve. Defaults to :code:`None`,
            which retrieves the default connection.
        :return: A dict of connection settings
        :raises `giraffez.errors.ConfigurationError`: if :code:`dsn` does not exist and a
        :raises `giraffez.errors.ConnectionLock`: if the corresponding connection is currently locked
            default is not set.
        """
        if dsn is None:
            dsn = self.connections.get("default", None)
            if dsn is None:
                raise ConfigurationError("No default DSN set")
        connection = self.connections.get(dsn, None)
        if connection is None:
            raise ConfigurationError("DSN '{}' does not exist".format(dsn))
        connection = self.decrypt(connection.copy())
        if connection.get('lock', 0) > 1:
            raise ConnectionLock(dsn)
        connection['name'] = dsn
        return connection
def get_connection(self, dsn=None):
        """
        Retrieve a connection by the given :code:`dsn`, or the default connection.

        :param str dsn: The name of the connection to retrieve. Defaults to :code:`None`,
            which retrieves the default connection.
        :return: A dict of connection settings
        :raises `giraffez.errors.ConfigurationError`: if :code:`dsn` does not exist and a
        :raises `giraffez.errors.ConnectionLock`: if the corresponding connection is currently locked
            default is not set.
        """
        if dsn is None:
            dsn = self.connections.get("default", None)
            if dsn is None:
                raise ConfigurationError("No default DSN set")
        connection = self.connections.get(dsn, None)
        if connection is None:
            raise ConfigurationError("DSN '{}' does not exist".format(dsn))
        connection = self.decrypt(connection.copy())
        if connection.get('lock', 0) > 1:
            raise ConnectionLock(dsn)
        connection['name'] = dsn
        return connection
Retrieve a connection by the given :code:`dsn`, or the default connection.

        :param str dsn: The name of the connection to retrieve. Defaults to :code:`None`,
            which retrieves the default connection.
        :return: A dict of connection settings
        :raises `giraffez.errors.ConfigurationError`: if :code:`dsn` does not exist and a
        :raises `giraffez.errors.ConnectionLock`: if the corresponding connection is currently locked
            default is not set.