Skip to content

Commit

Permalink
* shifty.py: code for installing space attributes into the database.
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Mar 6, 2010
1 parent 725e02b commit 66fbaa4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions shifty.py
Expand Up @@ -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.
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 66fbaa4

Please sign in to comment.