Beispiel #1
0
def eval_str(item, _globals, _locals):
    if isinstance(item, basestring):
        if item.startswith("evaltostr_"):
            return str(eval(item[10:], _globals, _locals))
        elif item.startswith("evaltonum_"):
            return eval(item[10:], _globals, _locals)
        elif is_flatstring(item):
            return flatstring_revert(item)
        return item
    else:
        return item
Beispiel #2
0
def eval_attr(container, _globals, _locals):
    for key, val in container.items():
        if isinstance(val, basestring):
            if val.startswith("evaltostr_"):
                container[key] = str(eval(val[10:], _globals, _locals))
            elif val.startswith("evaltoobj_"):
                obj = eval(val[10:], _globals, _locals)
                container[key] = objectify(obj)
            elif is_flatstring(val):
                container[key] = eval(flatstring_revert(val), _globals, _locals)
            elif val.startswith("deferredeval_"):
                deferredp4d = DeferredP4D(val[13:], (container, key), None)
                container[key] = deferredp4d
                _globals["deferredobj"].append(deferredp4d)