Source

django-odb / odb / traverse.py

Full commit
from odb.models import odb_dict

def get_object(path):
    if path == '/':
        return odb_dict
    if path[-1] == '/':
        path = path[:-1]
    try:
        o = "odb_dict"
        for e in path[1:].split('/'):
            o += "['%s']" % e
        ob = eval(o)
    except KeyError:
        return None
    return ob

def put_object(path, o):
    if path == '/':
        return False
    if path[-1] == '/':
        path = path[:-1]
    ob = "odb_dict"
    for e in path[1:].split('/')[:-1]:
        ob += "['%s']" % str(e)
    eval(ob)[str(path.split('/')[-1])] = o
    odb_dict.sync()
    return True