data/dumpable.py
def dump_data():
    """Dumps the whole dataset to Cloud Datastore"""
    if not empty_dataset():
        import json
        client = datastore.Client()
        key = client.key("Data", 1)
        client.delete(key)

        # Prepares the new entity
        data = datastore.Entity(key=key, exclude_from_indexes=("groups", "users", "drivers"))
        data["groups"] = json.dumps(dataset.groups)
        data["users"] = json.dumps(dataset.users)
        data["drivers"] = json.dumps(dataset.drivers)

        # Saves the entity
        client.put(data)
        return True
    else:
        log.critical("Trying to save empty data!")
        return False
Dumps the whole dataset to Cloud Datastore
Dumps the whole dataset to Cloud Datastore
Dumps the whole dataset to Cloud Datastore
def dump_data():
    if not empty_dataset():
        import json
        client = datastore.Client()
        key = client.key("Data", 1)
        client.delete(key)
        data = datastore.Entity(key=key, exclude_from_indexes=("groups", "users", "drivers"))
        data["groups"] = json.dumps(dataset.groups)
        data["users"] = json.dumps(dataset.users)
        data["drivers"] = json.dumps(dataset.drivers)
        client.put(data)
        return True
    else:
        log.critical("Trying to save empty data!")
        return False
def dump_data ( ) : if not empty_dataset ( ) : import json client = datastore . Client ( ) key = client . key ( "Data" , 1 ) client . delete ( key ) data = datastore . Entity ( key = key , exclude_from_indexes = ( "groups" , "users" , "drivers" ) ) data [ "groups" ] = json . dumps ( dataset . groups ) data [ "users" ] = json . dumps ( dataset . users ) data [ "drivers" ] = json . dumps ( dataset . drivers ) client . put ( data ) return True else : log . critical ( "Trying to save empty data!" ) return False
Dumps the whole dataset to Cloud Datastore
Dumps the whole dataset to Cloud Datastore
"""Dumps the whole dataset to Cloud Datastore""" # Prepares the new entity
 # Saves the entity
