~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches.py

  • Committer: Michael Hudson
  • Date: 2008-06-20 03:46:24 UTC
  • mfrom: (159.2.51 wsgi-ify)
  • Revision ID: michael.hudson@canonical.com-20080620034624-p46dvwbhppj2pojw
merge wsgi-ify
this removes the dependency on turbogears and cherrypy in favour of one on
paste (http://pythonpaste.org).
it adds a new executable, serve-branches.py, that serves branches following the
structure of the file system, but also converts start-loggerhead.py to serve
things from a loggerhead.conf file the 'old-fashioned' way.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
import sys
3
 
 
 
1
from loggerhead.apps.filesystem import BranchesFromFileSystemRoot
4
2
from paste import httpserver
5
 
from paste.httpexceptions import HTTPExceptionHandler
6
 
from paste.translogger import TransLogger
7
 
 
8
 
from loggerhead.apps.filesystem import BranchesFromFileSystemRoot
9
 
 
10
 
if len(sys.argv) > 1:
11
 
    path = sys.argv[1]
12
 
else:
13
 
    path = '.'
14
 
 
15
 
app = BranchesFromFileSystemRoot(path)
16
 
 
17
 
app = HTTPExceptionHandler(app)
18
 
app = TransLogger(app)
19
 
 
20
 
try:
21
 
    from paste.deploy.config import PrefixMiddleware
22
 
except ImportError:
23
 
    pass
24
 
else:
25
 
    app = PrefixMiddleware(app)
 
3
from paste.httpexceptions import make_middleware
 
4
from paste.translogger import make_filter
 
5
 
 
6
app = BranchesFromFileSystemRoot('.')
 
7
 
 
8
app = app
 
9
app = make_middleware(app)
 
10
app = make_filter(app, None)
26
11
 
27
12
#from paste.evalexception import EvalException
28
13
#app = EvalException(app)
29
14
 
30
 
httpserver.serve(app, host='0.0.0.0', port='8080')
 
15
httpserver.serve(app, host='0.0.0.0', port='9876')