Example #1
0
    def GET(self, number_of_words=8):
        iid = crypto.genrandomid(number_of_words)

        web.header("Cache-Control", "no-cache, no-store, must-revalidate")
        web.header("Pragma", "no-cache")
        web.header("Expires", "-1")
        return render.generate(iid)
Example #2
0
  def GET(self, number_of_words=8):
    if (number_of_words not in range(4, 11)):
      raise web.notfound()
    iid = crypto.genrandomid(number_of_words)

    web.header('Cache-Control', 'no-cache, no-store, must-revalidate')
    web.header('Pragma', 'no-cache')
    web.header('Expires', '-1')
    return render.generate(iid)
Example #3
0
 def GET(self):
     web.header("Content-Type", "application/json")
     request_params = web.input()
     if "words" in request_params:
         word_num = int(request_params["words"])
         uid = crypto.genrandomid(word_num)
         return json.dumps({"result": "success", "id": uid})
     else:
         return json.dumps({"result": "fail"})
Example #4
0
    def GET(self, number_of_words=8):
        if (number_of_words not in range(4, 11)):
            raise web.notfound()
        iid = crypto.genrandomid(number_of_words)

        web.header('Cache-Control', 'no-cache, no-store, must-revalidate')
        web.header('Pragma', 'no-cache')
        web.header('Expires', '-1')
        return render.generate(iid)
Example #5
0
 def GET(self):
     web.header('Content-Type', 'application/json')
     request_params = web.input()
     if 'words' in request_params:
         word_num = int(request_params['words'])
         if (word_num not in range(4, 11)):
             raise web.notfound()
         uid = crypto.genrandomid(word_num)
         return json.dumps({'result': 'success', 'id': uid})
     else:
         return json.dumps({'result': 'fail'})
Example #6
0
    def POST(self):
        iid = crypto.genrandomid()
        if os.path.exists(store.path(crypto.shash(iid))):
            # if this happens, we're not using very secure crypto
            store.log('Got a duplicate ID.')
        else:
            os.mkdir(store.path(crypto.shash(iid)))

        web.header('Cache-Control', 'no-cache, no-store, must-revalidate')
        web.header('Pragma', 'no-cache')
        web.header('Expires', '-1')
        return render.generate(iid)
Example #7
0
 def POST(self):
     iid = crypto.genrandomid()
     if os.path.exists(store.path(crypto.shash(iid))):
         # if this happens, we're not using very secure crypto
         store.log('Got a duplicate ID.')
     else:
         os.mkdir(store.path(crypto.shash(iid)))
         
     web.header('Cache-Control', 'no-cache, no-store, must-revalidate')
     web.header('Pragma', 'no-cache')
     web.header('Expires', '-1')
     return render.generate(iid)