~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Matt Nordhoff
  • Date: 2009-06-03 23:21:52 UTC
  • mfrom: (359.2.2 allow-writes)
  • Revision ID: mnordhoff@mattnordhoff.com-20090603232152-9dqje90otjz7s82m
Support writing to the Bazaar server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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]
 
76
        argv = ['--host', host, '--port', str(port), '--', transport.base]
 
77
        if not transport.is_readonly():
 
78
            argv.insert(0, '--allow-writes')
77
79
        config = LoggerheadConfig(argv)
78
80
        app = BranchesFromTransportRoot(transport, config)
79
81
        app = HTTPExceptionHandler(app)
97
99
            def run(self, *args, **kw):
98
100
                if 'http' in kw:
99
101
                    from bzrlib.transport import get_transport
 
102
                    allow_writes = kw.get('allow_writes', False)
100
103
                    path = kw.get('directory', '.')
101
104
                    port = kw.get('port', DEFAULT_PORT)
102
105
                    # port might be an int already...
104
107
                        host, port = port.split(':')
105
108
                    else:
106
109
                        host = DEFAULT_HOST
107
 
                    transport = get_transport(path)
 
110
                    if allow_writes:
 
111
                        transport = get_transport(path)
 
112
                    else:
 
113
                        transport = get_transport('readonly+' + path)
108
114
                    serve_http(transport, host, port)
109
115
                else:
110
116
                    super(cmd_serve, self).run(*args, **kw)