示例#1
0
    def post(self):
        mp = {}
        mp["name"] = self.request.get("name")
        mp["length"] = int(self.request.get("length"), 10)

        mthnr = datetime.datetime.now().month
        fb = Firebase("crackling-fire-8175.firebaseio.com/" + str(mthnr))

        while 1:
            rid = ''.join(random.SystemRandom().choice(string.ascii_uppercase +
                                                       string.digits)
                          for _ in range(URL_LENGTH))
            tst = fb.get("/" + rid)
            if tst == None:
                print "Improbability drive !!!!"
            else:
                break

        #
        # R E M O V E   T H I S
        #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
#         rid = "4M29YJ2"  #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

        mp["room"] = rid
        dataa = {"game": mp, "board": createTiles(mp["length"])}

        fb.set(rid, dataa)

        self.redirect("/" + rid)
示例#2
0
    def get(self):
        mthnr = datetime.datetime.now().month - 1

        if mthnr == 0:
            gon = 11
        else:
            gon = mthnr

        fb = Firebase("crackling-fire-8175.firebaseio.com/")
        fb.delete(str(gon))

        self.response.write("Deleting month: " + str(gon))