Exemple #1
0
 def __init__(self, configpath):
     conf = SafeConfigParser()
     conf.readfp(open(configpath))
     self.conf = conf
     if not conf.has_option_with_value('server', 'module'):
         raise ServerConfigurationError(
             'The factory module is not defined in the configuration file.')
     try:
         mapfactorymodule = __import__(conf.get('server', 'module'))
     except ImportError:
         raise ServerConfigurationError(
             'The factory module could not be loaded.')
     if hasattr(mapfactorymodule, 'WMSFactory'):
         self.mapfactory = getattr(mapfactorymodule, 'WMSFactory')()
     else:
         raise ServerConfigurationError(
             'The factory module does not have a WMSFactory class.')
     if conf.has_option('server', 'debug'):
         self.debug = int(conf.get('server', 'debug'))
     else:
         self.debug = 0
     if self.conf.has_option_with_value('server', 'maxage'):
         self.max_age = 'max-age=%d' % self.conf.get('server', 'maxage')
     else:
         self.max_age = None
Exemple #2
0
 def __init__(self):
     conf = SafeConfigParser()
     conf.readfp(open(self.configpath))
     self.conf = conf
     if not conf.has_option_with_value('server', 'module'):
         raise ServerConfigurationError('The factory module is not defined in the configuration file.')
     try:
         mapfactorymodule = __import__(conf.get('server', 'module'))
     except ImportError:
         raise ServerConfigurationError('The factory module could not be loaded.')
     if hasattr(mapfactorymodule, 'WMSFactory'):
         self.mapfactory = getattr(mapfactorymodule, 'WMSFactory')()
     else:
         raise ServerConfigurationError('The factory module does not have a WMSFactory class.')
     if conf.has_option('server', 'debug'):
         self.debug = int(conf.get('server', 'debug'))
     else:
         self.debug = 0