Exemple #1
0
def wsgiApp(environ, start_response):
    global theService

    cfgs = cfgfiles
    if not theService:
        theService = Service.load(cfgs)
    return wsgiHandler(environ, start_response, theService)
Exemple #2
0
    def tilecache(self, environ, start_response):
        try:
            expiration = self.service.config.getint('cache', 'expire')
        except NoOptionError:
            expiration = DEFAULT_EXPIRATION

        # custom_start_response adds cache headers to the response
        def custom_start_response(status, headers, exc_info=None):
            headers.append(('Cache-Control', 'public, max-age=%s'
                % expiration))
            headers.append(('Expires', email.Utils.formatdate(
                time.time() + expiration, False, True)))
            return start_response(status, headers, exc_info)

        return wsgiHandler(environ, custom_start_response, self.service)
Exemple #3
0
def tilecache(environ, start_response):
    try:
        expiration = _service.config.getint('cache', 'expire')
    except ConfigParser.NoOptionError:
        expiration = DEFAULT_EXPIRATION

    # custom_start_response adds cache headers to the response
    def custom_start_response(status, headers, exc_info=None):
        headers.append(('Cache-Control', 'public, max-age=%s' % expiration))
        headers.append(('Expires',
                        email.Utils.formatdate(time.time() + expiration, False,
                                               True)))
        return start_response(status, headers, exc_info)

    return wsgiHandler(environ, custom_start_response, _service)
Exemple #4
0
def tilecache (environ, start_response):

    svc = get_tileservice(environ)

    # Set the PATH_INFO and SCRIPT_NAME appropriately for wsgiHandler
    try:
        req = environ['selector.vars']['req']
        if req is None:
            raise KeyError('req not found in selector.vars')
    
        path_info = environ['PATH_INFO']
        environ['SCRIPT_NAME'] += path_info[:len(path_info)-len(req)]
        environ['PATH_INFO'] = req
    except KeyError:
        environ['SCRIPT_NAME'] += environ['PATH_INFO']
        environ['PATH_INFO'] = ''
        
    return wsgiHandler(environ, start_response, _tilecache_service)
Exemple #5
0
def application(environ, start_response):
    """Go service."""
    if not theService["app"]:
        theService["app"] = Service.load(cfgfiles)
    return wsgiHandler(environ, start_response, theService["app"])
 def app(environ, start_response):
     return wsgiHandler(environ, start_response, service)