def _set_key(crate, key, name, val, fix_type=False, dtype=str): key.name = str(name).strip().upper() if fix_type: val = dtype(val) key.set_value( val ) pycrates.add_key(crate, key)
def _set_key(crate, name, val, fix_type=False, dtype=str): """ checked for new crates """ key = pycrates.CrateKey() key.name = str(name).strip().upper() if fix_type: val = dtype(val) key.value = val pycrates.add_key(crate, key)
def create_key(kname, kval, desc=None): store[kname] = crates.CrateKey() store[kname].name = kname if desc != None: store[kname].desc = desc if 1 != store[kname].load(kval): raise RuntimeError, "Unable to set key %s to %g" % (name, kval) if 1 != crates.add_key(cr, store[kname]): raise RuntimeError, "Unable to add key %s to Crates." % kname