diff options
| author | ianb <devnull@localhost> | 2005-05-30 20:49:51 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-05-30 20:49:51 +0000 |
| commit | c3338c28c1cb12ac37941be5210fc4f2d55790e8 (patch) | |
| tree | 8e1afa496ea411066c454b11ea050e5c6a0a1d97 /paste/server.py | |
| parent | b4397d718d65e87bcb4a58d6e68a7b46df0ad032 (diff) | |
| download | paste-c3338c28c1cb12ac37941be5210fc4f2d55790e8.tar.gz | |
Added urlmap, which does top-level mapping to different applications, without any 'parsing' phase, typically using configuration files as application descriptors. Also added use_package function to configuration, which requires and installs the named package with easy_install.
Diffstat (limited to 'paste/server.py')
| -rwxr-xr-x | paste/server.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/paste/server.py b/paste/server.py index 2db0ed7..980eb35 100755 --- a/paste/server.py +++ b/paste/server.py @@ -53,6 +53,7 @@ from paste import reloader from paste import CONFIG from paste.util import plugin from paste import pyconfig +from paste import urlmap reloader_environ_key = 'WSGI_RELOADER_SHOULD_RUN' @@ -177,6 +178,10 @@ def help(): program = sys.argv[0] return help_message % {'program': program} +def make_app_from_filename(filename): + conf = pyconfig.setup_config(filename) + return make_app(conf) + def make_app(conf): framework_name = conf.get('framework', 'default') framework = plugin.load_plugin_module( @@ -185,7 +190,25 @@ def make_app(conf): framework_name, '_framework') app = framework.build_application(conf) - return app + mapper = conf.get('system_urlmap') + if mapper: + mapper[''] = app + return mapper + else: + return app + +def make_proxy(conf, filename, namespace): + mapper = conf.get('system_urlmap') + if mapper is None: + namespace['system_urlmap'] = mapper = urlmap.URLMap() + current_url = conf.get('base_paste_url') + if current_url is None: + namespace['base_paste_url'] = current_url = '' + return urlmap.PathProxyURLMap( + mapper, current_url, os.path.dirname(filename), + make_app_from_filename) + +pyconfig.Config.builtins['urlmap'] = make_proxy def restart_with_reloader(conf): if conf['verbose']: |
