Esempio n. 1
0
 def keytest3(self,x):
     es.keyploadfromfile(x, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     y = es.keypfindsubkey(x, "subkey", False)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome==99)
     z = es.keypfindsubkey(y, "test", True)
     name = es.keypgetname(z)
     self.failUnless(name =="test")
     pp = es.keypcreate()
     es.keyploadfromfile(pp, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     es.keyprecursivekeycopy(z, pp)
     name = es.keypgetname(z)
     self.failUnless(name == "justice2")
 def keytest3(self, x):
     es.keyploadfromfile(
         x, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     y = es.keypfindsubkey(x, "subkey", False)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome == 99)
     z = es.keypfindsubkey(y, "test", True)
     name = es.keypgetname(z)
     self.failUnless(name == "test")
     pp = es.keypcreate()
     es.keyploadfromfile(
         pp, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     es.keyprecursivekeycopy(z, pp)
     name = es.keypgetname(z)
     self.failUnless(name == "justice2")
Esempio n. 3
0
 def __setitem__(self, name, value):
     '''
     Stores a name/value pair in the keygroup. Only ints, floats, strings,
     and KeyValues classes (as subkeys) can be stored.
     '''
     if (isinstance(value, KeyValues)):
         x = es.keypfindsubkey(self._id_, str(name), True)
         if x:
             es.keyprecursivekeycopy(x, value._id_)
     else:
         if (isinstance(value, int)):
             es.keypsetint(self._id_, str(name), value)
         elif (isinstance(value, float)):
             es.keypsetfloat(self._id_, str(name), value)
         else:
             es.keypsetstring(self._id_, str(name), str(value))
 def __setitem__(self, name, value):
     '''
     Stores a name/value pair in the keygroup. Only ints, floats, strings,
     and KeyValues classes (as subkeys) can be stored.
     '''
     if (isinstance(value, KeyValues)):
         x = es.keypfindsubkey(self._id_, str(name), True)
         if x:
             es.keyprecursivekeycopy(x, value._id_)
     else:
         if (isinstance(value, int)):
             es.keypsetint(self._id_, str(name), value)
         elif (isinstance(value, float)):
             es.keypsetfloat(self._id_, str(name), value)
         else:
             es.keypsetstring(self._id_, str(name), str(value))