Beispiel #1
0
def download_wordbook(environ):
    dict_from_client = parse_qs(getRequestBody(environ))
    username = parse_qs(environ['QUERY_STRING']).get('username', [0])[0]
    password = parse_qs(environ['QUERY_STRING']).get('password', [0])[0]

    dict_for_return = dict(universal_POST_dict)
    if not verifyLogin(username, password):
        dict_for_return['verified'] = False
        dict_for_return['message_str'] = "login failed"
        dict_for_return['wordbook'] = []
        json_for_return = json.dumps(dict_for_return)
        return json_for_return
    else:
        dbMgr = MmrzSyncDBManager(username)
        dbMgr.createDB()
        rows = dbMgr.readAllDB()
        dict_for_return['verified'] = True
        dict_for_return['message_str'] = "Download success"
        dict_for_return['wordbook'] = rows
        json_for_return = json.dumps(dict_for_return)
        return json_for_return
Beispiel #2
0
def database_info(environ):
    dbMgr = MmrzSyncDBManager("wordbook")
    rows = dbMgr.readAllDB()
    dbMgr.closeDB()

    return json.dumps(rows)