~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to start-loggerhead.py

  • Committer: Martin Albisetti
  • Date: 2008-06-20 18:04:33 UTC
  • mto: (157.1.3 loggerhead)
  • mto: This revision was merged to the branch mainline in revision 187.
  • Revision ID: argentina@gmail.com-20080620180433-y5cw7g6lsk5h28x3
Adapt to WSGI

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
 
50
49
    access_log.setLevel(logging.INFO)
51
50
    access_log.setFormatter(f)
52
51
 
53
 
    logging.getLogger('').setLevel(logging.DEBUG)
54
52
    logging.getLogger('').addHandler(debug_log)
55
 
    logging.getLogger('wsgi').addHandler(access_log)
 
53
    logging.getLogger('turbogears.access').addHandler(access_log)
 
54
    logging.getLogger('turbogears.controllers').setLevel(logging.INFO)
56
55
 
57
56
    if foreground:
58
57
        logging.getLogger('').addHandler(stdout_log)
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(