~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to start-loggerhead.py

  • Committer: Michael Hudson
  • Date: 2008-06-23 01:03:34 UTC
  • Revision ID: michael.hudson@canonical.com-20080623010334-gyoub425l74zs33h
how url_prefix used to work

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import logging
4
4
import logging.handlers
5
 
from optparse import OptionParser
6
5
import os
7
6
import sys
8
 
import urlparse
 
7
from optparse import OptionParser
9
8
 
10
9
from configobj import ConfigObj
11
10
 
122
121
    app = make_filter(app, None)
123
122
 
124
123
    if webpath:
125
 
        scheme, netloc, path, blah, blah, blah = urlparse.urlparse(webpath)
126
 
        def app(environ, start_response, orig=app):
127
 
            environ['SCRIPT_NAME'] = path
128
 
            environ['HTTP_HOST'] = netloc
129
 
            return orig(environ, start_response)
 
124
        if not webpath.endswith('/'):
 
125
            webpath += '/'
 
126
        def app(environ, start_response, app=app):
 
127
            environ['SCRIPT_NAME'] = webpath
 
128
            return app(environ, start_response)
130
129
 
131
130
    try:
132
131
        httpserver.serve(