コード例 #1
0
ファイル: crowdre_main.py プロジェクト: AntiCloud/CloudNein
def main():
    if len(sys.argv) != 2:
    	print "Usage: <database filename (will be created if none exists)>"
    	return

    root = Root()

    name = sys.argv[1]
    db = cs.connect(name)
    cs.setup(db)

    def putEndpoint(cname):
        r = cname()
        r.db = db
        root.putChild(cname.leafName, r)

    putEndpoint(Version)
    putEndpoint(Commit)
    putEndpoint(Revisions)
    putEndpoint(Checkout)
    putEndpoint(LastRevs)


    site = server.Site(root)
    reactor.listenTCP(8080, site)
    reactor.run()
コード例 #2
0
ファイル: crowdre_main.py プロジェクト: firebitsbr/CloudNein
def main():
    if len(sys.argv) != 2:
        print "Usage: <database filename (will be created if none exists)>"
        return

    root = Root()

    name = sys.argv[1]
    db = cs.connect(name)
    cs.setup(db)

    def putEndpoint(cname):
        r = cname()
        r.db = db
        root.putChild(cname.leafName, r)

    putEndpoint(Version)
    putEndpoint(Commit)
    putEndpoint(Revisions)
    putEndpoint(Checkout)
    putEndpoint(LastRevs)

    site = server.Site(root)
    reactor.listenTCP(8080, site)
    reactor.run()
コード例 #3
0
def main():
    if len(sys.argv) != 5:
    	print "Usage: <database filename> <name> <email> <authtoken>"
    	return
    	
    name = sys.argv[1]
    username = sys.argv[2]
    email = sys.argv[3]
    authtoken = sys.argv[4]
    db = cs.connect(name)
    cs.setup(db)

    r = db.execute("""select count(*) from author""")
    idcount = r.fetchone()[0]
    idcount = idcount + 1
    
    r = db.execute("""insert into author values (%d, '%s', '%s')""" % (idcount, username, email))
    r = db.execute("""insert into token values ('%s', %d)""" % (authtoken, idcount))
    db.commit()
    
    print "User inserted successfully!"
    return
コード例 #4
0
def main():
    if len(sys.argv) != 5:
        print "Usage: <database filename> <name> <email> <authtoken>"
        return

    name = sys.argv[1]
    username = sys.argv[2]
    email = sys.argv[3]
    authtoken = sys.argv[4]
    db = cs.connect(name)
    cs.setup(db)

    r = db.execute("""select count(*) from author""")
    idcount = r.fetchone()[0]
    idcount = idcount + 1

    r = db.execute("""insert into author values (%d, '%s', '%s')""" %
                   (idcount, username, email))
    r = db.execute("""insert into token values ('%s', %d)""" %
                   (authtoken, idcount))
    db.commit()

    print "User inserted successfully!"
    return