Logo Search packages:      
Sourcecode: zope-maildrophost version File versions  Download package

def Products::MaildropHost::MaildropHost::MaildropHost::setConfigPath (   self,

Set the path to the currently active configuration file

Definition at line 108 of file MaildropHost.py.

00108                                      :
        """ Set the path to the currently active configuration file
        config_path = CONFIG_PATHS.get(path_key, None)

        # Prevent passing in an invalid key, or maybe even a path
        if config_path is None:
            raise ValueError('Invalid path key %s' % path_key)

        # Make sure the provided configuration paths exist
        if not os.path.isfile(config_path):
            raise ValueError('Invalid config file path %s' % config_path)

        # Try to load the configuration to make sure we have a valid
        # configuration file.
        config = dict(parse_assignments(open(config_path).read()))
        for needed in ('SMTP_HOST', 'SMTP_PORT', 'MAILDROP_INTERVAL',
                       'MAILDROP_HOME', 'MAILDROP_TLS'):
            if config.get(needed, None) is None:
                raise RuntimeError('Invalid configuration file '
                                   'at %s' % config_path)

        # Persist the new path, and then reload the configuration
        self.config_path = CONFIG_PATHS.get(path_key)
    security.declareProtected(change_configuration, 'getCandidateConfigPaths')
    def getCandidateConfigPaths(self):

Generated by  Doxygen 1.6.0   Back to index