예제 #1
0
파일: COMARAPI.py 프로젝트: Tayyib/uludag
	def saveValue(self, name = "", value = None, mode = 'instance', callerInfo = None, profile = None):
		""" Save a persistent value to object storage """

		# We can use a hash db, SQL DB etc.
		# But current debug requirements
		# require a simple format.
		if profile:
			pass
		
		dbpath = self.getDBFileKey(mode, callerInfo)
		dbkey = dbpath + name

		dbfile = open(dbkey, 'w')
		dbfile.write(COMARValue.dump_value_xml(value))

		dbfile.close()
예제 #2
0
def _testPipe(cmd="TRSU_CKTA", data="serdar"):
    p = COMARPipe()

    x = os.fork()
    if x:
        p.initFor("parent")
        print "Parent: send bytes:"
        data = COMARValue.string_create("Ben bir stringim")
        ps = p.putCommand(cmd, 109, 159, cPickle.dumps(data))
        print "PARENT PUT:", ps
        st = ""
        os.wait()

    else:
        p.initFor("child")
        select.select([p.cmd_rfile], [], [], 10)
        cmd = p.getCommand()
        print "Command:", cmd
        value = cmd[3]
        cv = cPickle.loads(value)
        print "CHILD: CV =", cv, "CVS=", COMARValue.dump_value_xml(cv)
        sys.exit(1)