File tree 2 files changed +28
-6
lines changed
2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,31 @@ def init(dbname="shiftspace/master"):
49
49
sync ()
50
50
51
51
52
+ def installSpace (space ):
53
+ from models import core
54
+ import simplejson as json
55
+ fh = open (os .path .join ("spaces" , space , "attrs.json" ))
56
+ data = json .loads (fh .read ())
57
+ data ["type" ] = "space"
58
+ db = core .connect ()
59
+ if db .get (space ):
60
+ del db [space ]
61
+ db [space ] = data
62
+
63
+
64
+ DEFAULT_SPACES = (
65
+ "Notes" ,
66
+ "Highlights" ,
67
+ "SourceShift" ,
68
+ "ImageSwap" ,
69
+ )
70
+
71
+
72
+ def installDefaultSpaces ():
73
+ for space in DEFAULT_SPACES :
74
+ installSpace (space )
75
+
76
+
52
77
def sync (createAdmin = True ):
53
78
import models .core as core
54
79
from models .ssuser import SSUser
@@ -68,6 +93,8 @@ def sync(createAdmin=True):
68
93
master ["admins" ] = adminDoc
69
94
master ["shiftspace" ] = adminUser
70
95
96
+ installDefaultSpaces ()
97
+
71
98
Spaces = ViewDefinition ('spaces' , 'by_name' , '''
72
99
function(doc) {
73
100
if(doc.type == "space") {
Original file line number Diff line number Diff line change @@ -379,12 +379,7 @@ def installSpace(space):
379
379
"""
380
380
Installs a space's attributes into the database.
381
381
"""
382
- from server .models import core
383
- fh = open (os .path .join ("spaces" , space , "attrs.json" ))
384
- data = json .loads (fh .read ())
385
- data ["type" ] = "space"
386
- db = core .connect ()
387
- db [space ] = data
382
+ setup .installSpace (space )
388
383
389
384
390
385
def shell ():
You can’t perform that action at this time.
0 commit comments