~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Martin Albisetti
  • Date: 2009-06-03 13:05:20 UTC
  • mfrom: (359.1.2 lh)
  • Revision ID: martin.albisetti@canonical.com-20090603130520-60d328gn7xe7kh3u
Avoid diluting sys.path if loggerhead is installed systemwide, install loggerhead as a plugin (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    import bzrlib
37
37
    from bzrlib.api import require_any_api
38
38
 
39
 
    require_any_api(bzrlib, [(1, 13, 0), (1, 15, 0), (1, 16, 0), (1, 17, 0)])
 
39
    require_any_api(bzrlib, [(1, 11, 0), (1, 13, 0), (1, 15, 0)])
40
40
 
41
41
    # NB: Normally plugins should lazily load almost everything, but this
42
42
    # seems reasonable to have in-line here: bzrlib.commands and options are
73
73
            host = DEFAULT_HOST
74
74
        if port is None:
75
75
            port = DEFAULT_PORT
76
 
        argv = ['--host', host, '--port', str(port), '--', transport.base]
77
 
        if not transport.is_readonly():
78
 
            argv.insert(0, '--allow-writes')
 
76
        argv = ['--host', host, '--port', str(port), transport.base]
79
77
        config = LoggerheadConfig(argv)
80
78
        app = BranchesFromTransportRoot(transport, config)
81
79
        app = HTTPExceptionHandler(app)
99
97
            def run(self, *args, **kw):
100
98
                if 'http' in kw:
101
99
                    from bzrlib.transport import get_transport
102
 
                    allow_writes = kw.get('allow_writes', False)
103
100
                    path = kw.get('directory', '.')
104
101
                    port = kw.get('port', DEFAULT_PORT)
105
102
                    # port might be an int already...
107
104
                        host, port = port.split(':')
108
105
                    else:
109
106
                        host = DEFAULT_HOST
110
 
                    if allow_writes:
111
 
                        transport = get_transport(path)
112
 
                    else:
113
 
                        transport = get_transport('readonly+' + path)
 
107
                    transport = get_transport(path)
114
108
                    serve_http(transport, host, port)
115
109
                else:
116
110
                    super(cmd_serve, self).run(*args, **kw)