~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Matt Nordhoff
  • Date: 2009-05-17 11:10:38 UTC
  • mto: (346.2.1 serve-directory)
  • mto: This revision was merged to the branch mainline in revision 350.
  • Revision ID: mnordhoff@mattnordhoff.com-20090517111038-26vo32le1dyp42lh
Fix 'bzr serve --http' (bug #377551).

I also added an optional 'argv' argument to LoggerheadConfig, defaulting to sys.argv[1:] like it used to do.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
                import os.path, sys
72
72
                sys.path.append(os.path.dirname(__file__))
73
73
 
 
74
                from bzrlib.transport import get_transport
74
75
                from loggerhead.apps.transport import BranchesFromTransportRoot
 
76
                from loggerhead.config import LoggerheadConfig
75
77
                from paste.httpexceptions import HTTPExceptionHandler
76
78
                from paste.httpserver import serve
77
 
                a = HTTPExceptionHandler(BranchesFromTransportRoot('.'))
78
79
                port = kw.get('port', DEFAULT_PORT)
79
80
                # port might be an int already...
80
81
                if isinstance(port, basestring) and ':' in port:
81
82
                    host, port = port.split(':')
82
83
                else:
83
84
                    host = '0.0.0.0'
84
 
                serve(a, host=host, port=port)
 
85
                argv = ['--host', host, '--port', str(port)]
 
86
                config = LoggerheadConfig(argv)
 
87
                transport = get_transport('.')
 
88
                app = BranchesFromTransportRoot(transport, config)
 
89
                app = HTTPExceptionHandler(app)
 
90
                serve(app, host=host, port=port)
85
91
            else:
86
92
                super(cmd_serve, self).run(*args, **kw)
87
93