def _init_main_section(self, config): if not config.has_section(MAIN_SECTION): raise ValueError('Config file is missing required section: %s' % MAIN_SECTION) self.zodb_uri = _get_opt(config, MAIN_SECTION, 'zodb_uri') if isinstance(self.zodb_uri, unicode): self.zodb_uri = self.zodb_uri.encode('UTF-8') self.maildir = _get_opt(config, MAIN_SECTION, 'maildir') self.zodb_path = _get_opt(config, MAIN_SECTION, 'zodb_path', '/postoffice') self.ooo_loop_frequency = _get_opt_float(config, MAIN_SECTION, 'ooo_loop_frequency', '0') self.ooo_loop_headers = _get_opt_list(config, MAIN_SECTION, 'ooo_loop_headers', '') self.ooo_throttle_period = datetime.timedelta(seconds=_get_opt_int( config, MAIN_SECTION, 'ooo_throttle_period', '300')) self.max_message_size = _get_opt_bytes(config, MAIN_SECTION, 'max_message_size', '0') self.reject_filters = filters = [] filters_setting = _get_opt(config, MAIN_SECTION, 'reject_filters', None) if filters_setting is not None: for filter in [ f.strip() for f in filters_setting.strip().split('\n') ]: filters.append(self._init_filter(filter))
def _init_main_section(self, config): if not config.has_section(MAIN_SECTION): raise ValueError('Config file is missing required section: %s' % MAIN_SECTION) self.zodb_uri = _get_opt(config, MAIN_SECTION, 'zodb_uri') if isinstance(self.zodb_uri, unicode): self.zodb_uri = self.zodb_uri.encode('UTF-8') self.maildir = _get_opt(config, MAIN_SECTION, 'maildir') self.zodb_path = _get_opt(config, MAIN_SECTION, 'zodb_path', '/postoffice') self.ooo_loop_frequency = _get_opt_float( config, MAIN_SECTION, 'ooo_loop_frequency', '0') self.ooo_loop_headers = _get_opt_list( config, MAIN_SECTION, 'ooo_loop_headers', '') self.ooo_throttle_period = datetime.timedelta(seconds=_get_opt_int( config, MAIN_SECTION, 'ooo_throttle_period', '300')) self.max_message_size = _get_opt_bytes( config, MAIN_SECTION, 'max_message_size', '0') self.reject_filters = filters = [] filters_setting = _get_opt(config, MAIN_SECTION, 'reject_filters', None) if filters_setting is not None: for filter in [f.strip() for f in filters_setting.strip().split('\n')]: filters.append(self._init_filter(filter))
def _init_queue(self, config, section): name = section[6:] # len('queue:') == 6 filters = [] for option in config.options(section): if option == "filters": for filter_ in [f.strip() for f in config.get(section, option).strip().split("\n")]: filters.append(self._init_filter(filter_)) elif option == "here": pass else: raise ValueError("Unknown config parameter for queue: %s" % option) return dict(name=name, filters=filters, section=section)
def _init_queue(self, config, section): name = section[6:] # len('queue:') == 6 filters = [] for option in config.options(section): if option == 'filters': for filter_ in [ f.strip() for f in config.get( section, option).strip().split('\n') ]: filters.append(self._init_filter(filter_)) elif option == 'here': pass else: raise ValueError('Unknown config parameter for queue: %s' % option) return dict(name=name, filters=filters, section=section)
def _init_main_section(self, config): if not config.has_section(MAIN_SECTION): raise ValueError("Config file is missing required section: %s" % MAIN_SECTION) self.zodb_uri = _get_opt(config, MAIN_SECTION, "zodb_uri") if isinstance(self.zodb_uri, unicode): self.zodb_uri = self.zodb_uri.encode("UTF-8") self.maildir = _get_opt(config, MAIN_SECTION, "maildir") self.zodb_path = _get_opt(config, MAIN_SECTION, "zodb_path", "/postoffice") self.ooo_loop_frequency = _get_opt_float(config, MAIN_SECTION, "ooo_loop_frequency", "0") self.ooo_loop_headers = _get_opt_list(config, MAIN_SECTION, "ooo_loop_headers", "") self.ooo_throttle_period = datetime.timedelta( seconds=_get_opt_int(config, MAIN_SECTION, "ooo_throttle_period", "300") ) self.max_message_size = _get_opt_bytes(config, MAIN_SECTION, "max_message_size", "0") self.reject_filters = filters = [] filters_setting = _get_opt(config, MAIN_SECTION, "reject_filters", None) if filters_setting is not None: for filter in [f.strip() for f in filters_setting.strip().split("\n")]: filters.append(self._init_filter(filter))