Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.web.static Namespace Reference

Functions

def make_static_serving_app

Variables

tuple STATIC_FILES_PATH = join(abspath(dirname(__file__)), 'htdocs')

Function Documentation

def MoinMoin.web.static.make_static_serving_app (   application,
  shared 
)
wrap application in a static file serving app

@param application: WSGI wiki application that should be wrapped
@param shared:  directory where static files are located (then we create the
                usual mapping dict we need automatically), or a ready-to-use
                mapping dict for SharedDataMiddleware.
                If True, use builtin static files from STATIC_FILES_PATH.
@returns: wrapped WSGI application

Definition at line 58 of file __init__.py.

00058 
00059 def make_static_serving_app(application, shared):
00060     """
00061     wrap application in a static file serving app
00062 
00063     @param application: WSGI wiki application that should be wrapped
00064     @param shared:  directory where static files are located (then we create the
00065                     usual mapping dict we need automatically), or a ready-to-use
00066                     mapping dict for SharedDataMiddleware.
00067                     If True, use builtin static files from STATIC_FILES_PATH.
00068     @returns: wrapped WSGI application
00069     """
00070     if not isinstance(shared, dict):
00071         if shared is True:
00072             shared = STATIC_FILES_PATH
00073         if isdir(shared):
00074             shared = {config.url_prefix_static: shared,
00075                       # XXX only works / makes sense for root-mounted wikis:
00076                       '/favicon.ico': join(shared, 'favicon.ico'),
00077                       '/robots.txt': join(shared, 'robots.txt')}
00078         else:
00079             raise ValueError("Invalid path given for shared parameter")
00080     return SharedDataMiddleware(application, shared)
00081 

Here is the caller graph for this function:


Variable Documentation

tuple MoinMoin.web.static.STATIC_FILES_PATH = join(abspath(dirname(__file__)), 'htdocs')

Definition at line 55 of file __init__.py.