def write(self): if not check.type_write_file(self._path): return False self._write_file = open(self._path, "w") try: self.__lock_EX(self._write_file) return self._write() finally: self.__lock_UN(self._write_file) self._write_file.close() return True
def check_config(config): normal = True if normal and not "log.config" in config: print >>sys.stderr, "Configuration information is missing. - log.config" normal = False if normal and not check.type_file(config["log.config"]): print >>sys.stderr, "There is a mistake in the configuration information. - log.config=%s" % config[ "log.config" ] normal = False if normal and not "bin.dir" in config: print >>sys.stderr, "Configuration information is missing. - bin.dir" normal = False if normal and not check.type_dir(config["bin.dir"]): print >>sys.stderr, "There is a mistake in the configuration information. - bin.dir=%s" % config["bin.dir"] normal = False if normal and not check.type_read_file(config["bin.dir"]): print >>sys.stderr, "Not set the appropriate permissions to that directory. - bin.dir=%s" % config["bin.dir"] normal = False if normal and not "tmp.dir" in config: print >>sys.stderr, "Configuration information is missing. - tmp.dir" normal = False if normal and not check.type_dir(config["tmp.dir"]): print >>sys.stderr, "There is a mistake in the configuration information. - tmp.dir=%s" % config["tmp.dir"] normal = False if normal and not check.type_write_file(config["tmp.dir"]): print >>sys.stderr, "Not set the appropriate permissions to that directory. - tmp.dir=%s" % config["tmp.dir"] normal = False if normal and not "server.interface" in config: print >>sys.stderr, "Configuration information is missing. - server.interface" normal = False if normal and not "server.port" in config: print >>sys.stderr, "Configuration information is missing. - server.port" normal = False if normal and not check.type_int(config["server.port"]): print >>sys.stderr, "Please set it by the numerical value. - server.port=%s" % config["server.port"] normal = False if normal and not "uniqkey" in config: print >>sys.stderr, "Configuration information is missing. - uniqkey" normal = False if normal and not check.type_uuid(config["uniqkey"]): print >>sys.stderr, "UUID format is not set. - uniqkey" normal = False return normal