diff options
| author | Jeff Armstrong <jeff@approximatrix.com> | 2013-07-27 14:33:37 -0400 |
|---|---|---|
| committer | Jeff Armstrong <jeff@approximatrix.com> | 2013-07-27 14:33:37 -0400 |
| commit | f24f3866b5cc5ccf0eaf32489892e14f6d94f899 (patch) | |
| tree | eb081ef9f7adef6414e7d7ff98acdeddb7190304 /src/room.py | |
| parent | 032a02cb47fe933e423a06c4f79eeddecb5b8e68 (diff) | |
| download | pyohio2013-f24f3866b5cc5ccf0eaf32489892e14f6d94f899.tar.gz pyohio2013-f24f3866b5cc5ccf0eaf32489892e14f6d94f899.zip | |
database
Diffstat (limited to 'src/room.py')
| -rw-r--r-- | src/room.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/room.py b/src/room.py index 0db88ca..1bc3747 100644 --- a/src/room.py +++ b/src/room.py @@ -1,13 +1,19 @@ import json - +import sqlite3 def get_room(id): ret = None - with open(str(id)+".json", "r") as f: - jsontext = f.read() + + con = sqlite3.connect("game.db") + + for row in con.execute("select json from rooms where id=?",(id,)): + + jsontext = row[0] d = json.loads(jsontext) d['id'] = id ret = Room(**d) + break + return ret class Room(): |
