diff --git a/gratipay/main.py b/gratipay/main.py index eef8d010d9..c79850c1e3 100644 --- a/gratipay/main.py +++ b/gratipay/main.py @@ -65,6 +65,7 @@ tell_sentry = website.tell_sentry = gratipay.wireup.make_sentry_teller(env) website.db = gratipay.wireup.db(env) website.mailer = gratipay.wireup.mail(env, website.project_root) +gratipay.wireup.settings(website.db) gratipay.wireup.base_url(website, env) gratipay.wireup.secure_cookies(env) gratipay.wireup.billing(env) diff --git a/gratipay/testing/__init__.py b/gratipay/testing/__init__.py index f7f30856b5..60507d105f 100644 --- a/gratipay/testing/__init__.py +++ b/gratipay/testing/__init__.py @@ -115,7 +115,8 @@ def clear_tables(self): except (IntegrityError, InternalError): tablenames.insert(0, tablename) self.db.run("ALTER SEQUENCE participants_id_seq RESTART WITH 1") - self.db.run("INSERT INTO settings DEFAULT VALUES") + + gratipay.wireup.settings(self.db) def make_elsewhere(self, platform, user_id, user_name, **kw): diff --git a/gratipay/wireup.py b/gratipay/wireup.py index ad9ffe6844..4079f32e2c 100644 --- a/gratipay/wireup.py +++ b/gratipay/wireup.py @@ -57,11 +57,13 @@ def db(env): db.register_model(model) gratipay.billing.payday.Payday.db = db - from gratipay.billing.exchanges import MINIMUM_CHARGE - db.run('UPDATE settings SET minimum_charge=%s', (MINIMUM_CHARGE,)) - return db +def settings(db): + from gratipay.billing.exchanges import MINIMUM_CHARGE + db.run('DELETE FROM settings') + db.run('INSERT INTO settings VALUES (%s)', (MINIMUM_CHARGE, )) + def mail(env, project_root='.'): Participant._mailer = mandrill.Mandrill(env.mandrill_key) emails = {}