Changeset 6560

Show
Ignore:
Timestamp:
08/28/08 19:26:12 (4 months ago)
Author:
cdent
Message:

tiddlyweb - Make the new style of wsgi middleware config
work correctly with the googleappengine version of TiddlyWeb.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Trunk/contributors/ChrisDent/experimental/TiddlyWeb/googleappengine/main.py

    r6290 r6560  
    2626 
    2727 
    28 from tiddlyweb.web.serve import load_app, StoreSet, EncodeUTF8, UserExtract, Configurator, config 
    29 from tiddlyweb.auth import PermissionsExceptor 
    30 from tiddlyweb.web.negotiate import Negotiate 
    31 from tiddlyweb.web.query import Query 
    32 from tiddlyweb.web.http import HTTPExceptor 
    3328 
    3429import wsgiref.handlers 
    3530import urllib 
     31 
     32from tiddlyweb.web.serve import load_app, config 
    3633 
    3734class ScriptCleanup(object): 
     
    4441        return self.application(environ, start_response) 
    4542 
     43app = None 
    4644def google_app(): 
     45    """ 
     46    Only calculate the app once, otherwise we recalculate the 
     47    config settings with every request, which is not happy. 
     48    """ 
     49    global app 
     50    if app: 
     51        return app 
     52 
    4753    host = 'tiddlyweb.appspot.com' 
    4854    port = 80 
     
    5157    filename = 'urls.map' 
    5258 
    53     app = load_app(host, port, filename, [ 
    54         Negotiate, UserExtract, StoreSet, Query, Configurator, PermissionsExceptor, HTTPExceptor, EncodeUTF8 
    55         ]) 
    56     return ScriptCleanup(app) 
     59    filters_in = config['server_request_filters'] 
     60    filters_in.insert(0, ScriptCleanup) 
     61 
     62    app = load_app(host, port, filename) 
     63    return app 
    5764 
    5865def main():