Cleaned up websetup a little.
authorEevee <git@veekun.com>
Fri, 8 Jan 2010 01:56:38 +0000 (17:56 -0800)
committerEevee <git@veekun.com>
Fri, 8 Jan 2010 02:12:44 +0000 (18:12 -0800)
- SavedSearch.fork should not, apparently, have been required.

- websetup refuses to run if the database has already been set up.

- Creating the default Eevee user actually works now; needed a display
  name.

- The requisite art/ directory is included in the repository.

floof/model/search.py
floof/public/art/.gitignore [new file with mode: 0644]
floof/websetup.py

index 598999d..9dabd58 100644 (file)
@@ -5,7 +5,7 @@ from elixir import *
 class SavedSearch(Entity):
     string = Field(Unicode, required=True)
     author = ManyToOne('User', required=True)
-    fork = ManyToOne("SavedSearch", required=True)
+    fork = ManyToOne("SavedSearch")
 
     def __unicode__(self):
         return self.string
diff --git a/floof/public/art/.gitignore b/floof/public/art/.gitignore
new file mode 100644 (file)
index 0000000..bc7d02d
--- /dev/null
@@ -0,0 +1,3 @@
+# This directory exists only to hold art, which should never be committed.
+# Ignore anything in it.
+*
index 06c0e9c..8f3d896 100644 (file)
@@ -16,16 +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)
+    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()