view MoinMoin/server/ @ 4133:251827af7ddc

Fixed: cannot check for File.Error in same line like checking import of File
author Florian Krupicka <>
date Tue, 27 May 2008 18:13:17 +0200
parents c0becca3d0d9
line wrap: on
line source
    MoinMoin - WSGI application

    Minimal code for using this:

    from MoinMoin.server.server_wsgi import WsgiConfig, moinmoinApp

    class Config(WsgiConfig):

    config = Config() # you MUST create an instance
    # use moinmoinApp here with your WSGI server / gateway

    @copyright: 2005 Anakim Border <>,
                2007 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.

from MoinMoin.server import Config
from MoinMoin.request import request_wsgi

class WsgiConfig(Config):
    """ WSGI default config """

def moinmoinApp(environ, start_response):
    request = request_wsgi.Request(environ)
    start_response(request.status, request.headers)
    if request._send_file is not None:
        # moin wants to send a file (e.g. AttachFile.do_get)
        def simple_wrapper(fileobj, bufsize):
            return iter(lambda:, '')
        file_wrapper = environ.get('wsgi.file_wrapper', simple_wrapper)
        return file_wrapper(request._send_file, request._send_bufsize)
        return [request.output()] # don't we have a filelike there also!?