~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Matt Nordhoff
  • Date: 2009-05-18 05:08:58 UTC
  • mfrom: (346.2.2 serve-directory)
  • Revision ID: mnordhoff@mattnordhoff.com-20090518050858-3agh0ay1v2743m4t
Support "bzr serve"'s --directory argument.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
                from loggerhead.config import LoggerheadConfig
77
77
                from paste.httpexceptions import HTTPExceptionHandler
78
78
                from paste.httpserver import serve
 
79
                path = kw.get('directory', '.')
79
80
                port = kw.get('port', DEFAULT_PORT)
80
81
                # port might be an int already...
81
82
                if isinstance(port, basestring) and ':' in port:
82
83
                    host, port = port.split(':')
83
84
                else:
84
85
                    host = '0.0.0.0'
85
 
                argv = ['--host', host, '--port', str(port)]
 
86
                argv = ['--host', host, '--port', str(port), path]
86
87
                config = LoggerheadConfig(argv)
87
 
                transport = get_transport('.')
 
88
                transport = get_transport(path)
88
89
                app = BranchesFromTransportRoot(transport, config)
89
90
                app = HTTPExceptionHandler(app)
90
91
                serve(app, host=host, port=port)