Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

In-place config support

#49

(contribution of Bernardo Heynemann heynemann@gmail.com)

Add support to create a in-place config for cases that you would like to configure simple-db-migrate programatically.

Add the following code to core.py.

class InPlaceConfig(object):
    def __init__(self, db_host, db_user, db_password, db_name, migrations_dir, db_version_table="__db_version__"):
        self.__config = {
                            "db_host":db_host,
                            "db_user":db_user,
                            "db_password":db_password,
                            "db_name":db_name,
                            "db_version_table":db_version_table,
                            "migrations_dir":migrations_dir
                        }

    def get(self, config_key):
        try:
            return self.__config[config_key]
        except KeyError, e:
            raise Exception("invalid configuration key ('%s')" % config_key)

    def put(self, config_key, config_value):
        if config_key in self.__config:
            raise Exception("the configuration key '%s' already exists and you cannot override any configuration" % config_key)
        self.__config[config_key] = config_value

Reported by Guilherme Chapiewski · June 17th, 2009 @ 12:05 AM

State: resolved
Milestone: v1.2.8
Assigned to: Guilherme Chapiewski Guilherme Chapiewski

Activity

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.