From 66fbaa448c8a3001ce3e98644917eb7d738ad3d3 Mon Sep 17 00:00:00 2001 From: dnolen Date: Sat, 6 Mar 2010 17:55:48 -0500 Subject: [PATCH] * shifty.py: code for installing space attributes into the database. --- shifty.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shifty.py b/shifty.py index f2f07fa4..ccb3ce80 100755 --- a/shifty.py +++ b/shifty.py @@ -375,6 +375,18 @@ def runserver(argv): server.start() +def installSpace(space): + """ + Installs a space's attributes into the database. + """ + from server.models import core + fh = open(os.path.join("spaces", space, "attrs.json")) + data = json.loads(fh.read()) + data["type"] = "space" + db = core.connect() + db.create(data) + + def shell(): """ Launch the shell with the models loaded. Useful for testing. @@ -417,6 +429,8 @@ def main(argv): updatedb() elif action == "resetdb": resetdb() + elif action == "install": + installSpace(argv[1]) elif action == "setdbpath": try: url = argv[1]