def getSchema(): startup = os.path.dirname(os.path.realpath(ZServer.Zope2.Startup.__file__)) schemafile = os.path.join(startup, 'zopeschema.xml') opts = ZopeOptions() opts.schemafile = schemafile opts.load_schema() return opts.schema
def __init__(self): ZopeOptions.__init__(self) ZDCtlOptions.__init__(self) self.add("interactive", None, "i", "interactive", flag=1) self.add("default_to_interactive", "runner.default_to_interactive", default=1)
def getSchema(schemafile): global _SCHEMA if schemafile not in _SCHEMA: opts = ZopeOptions() opts.schemafile = schemafile opts.load_schema() _SCHEMA[schemafile] = opts.schema return _SCHEMA[schemafile]
def getSchema(): startup = os.path.dirname( os.path.realpath(ZServer.Zope2.Startup.__file__)) schemafile = os.path.join(startup, 'zopeschema.xml') opts = ZopeOptions() opts.schemafile = schemafile opts.load_schema() return opts.schema
def realize(self, *args, **kw): ZopeOptions.realize(self, *args, **kw) # Additional checking of user option; set uid and gid if self.user is not None: import pwd try: uid = int(self.user) except ValueError: try: pwrec = pwd.getpwnam(self.user) except KeyError: self.usage("username %r not found" % self.user) uid = pwrec[2] else: try: pwrec = pwd.getpwuid(uid) except KeyError: self.usage("uid %r not found" % self.user) gid = pwrec[3] self.uid = uid self.gid = gid config = self.configroot self.directory = config.instancehome self.clienthome = config.clienthome if self.program: if isinstance(self.program, basestring): self.program = [self.program] elif config.runner and config.runner.program: self.program = config.runner.program else: self.program = [os.path.join(self.directory, "bin", "runzope")] if self.sockname: # set by command line option pass elif config.runner and config.runner.socket_name: self.sockname = config.runner.socket_name else: self.sockname = os.path.join(self.clienthome, "zopectlsock") self.python = os.environ.get('PYTHON', config.python) or sys.executable self.zdrun = os.path.join(os.path.dirname(zdaemon.__file__), "zdrun.py") self.exitcodes = [0, 2] if self.logfile is None and config.eventlog is not None: for handler in config.eventlog.handler_factories: if isinstance(handler, FileHandlerFactory): self.logfile = handler.section.path if self.logfile not in ("STDERR", "STDOUT"): break