示例#1
0
 def index(self):
     """
     Serves the status page for developers.
     """
     import models.core
     t = Template(filename="html/index.mako", lookup=lookup)
     try:
         server = core.sharedServer()
         server.version
     except Exception:
         return self.statusPage(status="err", details="couchdb")
     try:
         db = core.connect()
         db["_design/users"]
     except:
         return self.statusPage(status="err", details="initdb")
     return self.statusPage()
示例#2
0
def init(dbname="shiftspace/master"):
    """
    Initialize the shiftspace database. Defaults to
    shiftspace for the database name.
    Parameters:
        dbname - the name of the database to use.
    """
    import models.core as core
    os.system("scripts/clear_sessions.sh")
    server = core.sharedServer()
    if not server.__contains__(dbname):
        print "Creating databases."
        server.create(dbname)
        server.create("shiftspace/public")
        server.create("shiftspace/shared")
        server.create("shiftspace/messages")
    else:
        print "%s database already exists." % dbname
    db = server[dbname]
    sync()
    installDefaultSpaces()
示例#3
0
 def sandbox(self):
     """
     For developers. Serves the sandbox development enviroment. Automatically cocatenates 
     and preprocess all of CSS files and HTML files for the interface and
     as well as all of the JavaScript before serving the page.
     """
     import models.core
     t = Template(filename="html/index.mako", lookup=lookup)
     try:
         server = core.sharedServer()
         server.version
     except Exception:
         return self.statusPage(status="err", details="couchdb")
     corebuilder.run()
     compiler = sandalphon.SandalphonCompiler()
     compiler.compile(inputFile="client/ShiftSpace.html",
                      outDir="builds/compiledViews",
                      envFile="mydev")
     preprocessor = preprocess.SSPreProcessor(project="sandbox", env="mydev")
     preprocessor.preprocess(input="client/ShiftSpace.js",
                             output="builds/shiftspace.sandbox.js")
     return serve_file(os.path.join(WEB_ROOT, 'sandbox/index.html'))
示例#4
0
def init(dbname="shiftspace/master"):
    """
    Initialize the shiftspace database. Defaults to
    shiftspace for the database name.
    Parameters:
        dbname - the name of the database to use.
    """
    import models.core as core
    import couchdb
    import sys
    os.system("scripts/clear_sessions.sh")
    server = core.sharedServer()
    if not server.__contains__(dbname):
        print "Creating databases."
        server.create(dbname)
        server.create("shiftspace/public")
        server.create("shiftspace/shared")
        server.create("shiftspace/messages")
    else:
        print "%s database already exists." % dbname
    db = server[dbname]
    sync()
    installDefaultSpaces()