X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/ea3d7fcf702e372eac978d61b9af9dbad46543bb..79cb1c0d3048c165fd3b9ff287ee1fbe361f904d:/floof/websetup.py?ds=inline diff --git a/floof/websetup.py b/floof/websetup.py index be104da..8f3d896 100644 --- a/floof/websetup.py +++ b/floof/websetup.py @@ -16,20 +16,19 @@ def setup_app(command, conf, vars): """Place any commands to setup floof here""" load_environment(conf.global_conf, conf.local_conf) + # We try to recreate the db when it already exists, like, a lot. This + # fucks everything. Do a dumb check for it. + assert not model.User.table.exists(), \ + "Database is already initialized; please purge it first." + ### Database schema model.metadata.create_all() ### Sample data # Users - from floof.model.users import IdentityURL, User - if not User.query.filter_by(name=u'eevee').count: - identity_url = IdentityURL(url=u'http://eevee.livejournal.com/') - user = User(name=u'eevee') - user.identity_urls.append(identity_url) - - ### Make the canonical user-page - from floof.model import UserPage - UserPage.make_primary_template() + identity_url = model.IdentityURL(url=u'http://eevee.livejournal.com/') + user = model.User(name=u'eevee', display_name=u'Eevee') + user.identity_urls.append(identity_url) model.Session.commit()