def initialize_1(config_path=None): """First initialization step. * Zope component architecture * The configuration system * Run-time directories :param config_path: The path to the configuration file. :type config_path: string """ zcml = resource_string('mailman.config', 'configure.zcml') xmlconfig.string(zcml) # By default, set the umask so that only owner and group can read and # write our files. Specifically we must have g+rw and we probably want # o-rwx although I think in most cases it doesn't hurt if other can read # or write the files. os.umask(0o007) # Initialize configuration event subscribers. This must be done before # setting up the configuration system. from mailman.app.events import initialize as initialize_events initialize_events() # config_path will be set if the command line argument -C is given. That # case overrides all others. When not given on the command line, the # configuration file is searched for in the file system. if config_path is None: config_path = search_for_configuration_file() elif config_path is INHIBIT_CONFIG_FILE: # For the test suite, force this back to not using a config file. config_path = None mailman.config.config.load(config_path)
def initialize_2(debug=False, propagate_logs=None): """Second initialization step. * Logging * Pre-hook * Rules * Chains * Pipelines * Commands :param debug: Should the database layer be put in debug mode? :type debug: boolean :param propagate_logs: Should the log output propagate to stderr? :type propagate_logs: boolean or None """ # Create the queue and log directories if they don't already exist. mailman.core.logging.initialize(propagate_logs) # Run the pre-hook if there is one. config = mailman.config.config if config.mailman.pre_hook: call_name(config.mailman.pre_hook) # Instantiate the database class, ensure that it's of the right type, and # initialize it. Then stash the object on our configuration object. database_class = config.database['class'] database = call_name(database_class) verifyObject(IDatabase, database) database.initialize(debug) config.db = database # Initialize the rules and chains. Do the imports here so as to avoid # circular imports. from mailman.app.commands import initialize as initialize_commands from mailman.app.events import initialize as initialize_events from mailman.core.chains import initialize as initialize_chains from mailman.core.pipelines import initialize as initialize_pipelines from mailman.core.rules import initialize as initialize_rules # Order here is somewhat important. initialize_rules() initialize_chains() initialize_pipelines() initialize_commands() initialize_events()
def initialize_1(config_path=None): """First initialization step. * Zope component architecture * The configuration system * Run-time directories :param config_path: The path to the configuration file. :type config_path: string """ zcml = resource_bytes('mailman.config', 'configure.zcml') xmlconfig.string(zcml.decode('utf-8')) # By default, set the umask so that only owner and group can read and # write our files. Specifically we must have g+rw and we probably want # o-rwx although I think in most cases it doesn't hurt if other can read # or write the files. os.umask(0o007) # Initialize configuration event subscribers. This must be done before # setting up the configuration system. from mailman.app.events import initialize as initialize_events initialize_events() # config_path will be set if the command line argument -C is given. That # case overrides all others. When not given on the command line, the # configuration file is searched for in the file system. if config_path is None: config_path = search_for_configuration_file() elif config_path is INHIBIT_CONFIG_FILE: # For the test suite, force this back to not using a config file. config_path = None mailman.config.config.load(config_path) # Use this environment variable to define an extra configuration file for # testing. This is used by the tox.ini to run the full test suite under # PostgreSQL. extra_cfg_path = os.environ.get('MAILMAN_EXTRA_TESTING_CFG') if extra_cfg_path is not None: with open(extra_cfg_path, 'r', encoding='utf-8') as fp: extra_cfg = fp.read() mailman.config.config.push('extra testing config', extra_cfg)
def initialize_1(config_path=None): """First initialization step. * Zope component architecture * The configuration system * Run-time directories :param config_path: The path to the configuration file. :type config_path: string """ zcml = resource_string('mailman.config', 'configure.zcml') xmlconfig.string(zcml) # By default, set the umask so that only owner and group can read and # write our files. Specifically we must have g+rw and we probably want # o-rwx although I think in most cases it doesn't hurt if other can read # or write the files. os.umask(0o007) # Initialize configuration event subscribers. This must be done before # setting up the configuration system. from mailman.app.events import initialize as initialize_events initialize_events() # config_path will be set if the command line argument -C is given. That # case overrides all others. When not given on the command line, the # configuration file is searched for in the file system. if config_path is None: config_path = search_for_configuration_file() elif config_path is INHIBIT_CONFIG_FILE: # For the test suite, force this back to not using a config file. config_path = None mailman.config.config.load(config_path) # Use this environment variable to define an extra configuration file for # testing. This is used by the tox.ini to run the full test suite under # PostgreSQL. extra_cfg_path = os.environ.get('MAILMAN_EXTRA_TESTING_CFG') if extra_cfg_path is not None: with open(extra_cfg_path) as fp: extra_cfg = fp.read().decode('utf-8') mailman.config.config.push('extra testing config', extra_cfg)