~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Matt Nordhoff
  • Date: 2009-10-17 06:19:40 UTC
  • mto: (329.2.2 trailing-whitespace)
  • mto: This revision was merged to the branch mainline in revision 392.
  • Revision ID: mnordhoff@mattnordhoff.com-20091017061940-w9tcvy0xs1irno3y
Some random PEP 8 and otehr stylistic changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
26
26
 
27
27
"""Loggerhead web viewer for Bazaar branches.
28
28
 
29
 
This provides a new option "--http" to the "bzr serve" command, that
 
29
This provides a new option "--http" to the "bzr serve" command, that 
30
30
starts a web server to browse the contents of a branch.
31
31
"""
32
32
 
38
38
 
39
39
    require_any_api(bzrlib, [
40
40
        (1, 13, 0), (1, 15, 0), (1, 16, 0), (1, 17, 0), (1, 18, 0),
41
 
        (2, 0, 0), (2, 1, 0), (2, 2, 0)])
 
41
        (2, 0, 0), (2, 1, 0)])
42
42
 
43
43
    # NB: Normally plugins should lazily load almost everything, but this
44
44
    # seems reasonable to have in-line here: bzrlib.commands and options are
65
65
        # loggerhead internal code will try to 'import loggerhead', so
66
66
        # let's put it on the path if we can't find it in the existing path
67
67
        try:
68
 
            import loggerhead.apps.transport
 
68
            import loggerhead
69
69
        except ImportError:
70
70
            import os.path, sys
71
71
            sys.path.append(os.path.dirname(__file__))
72
72
 
73
73
        from loggerhead.apps.transport import BranchesFromTransportRoot
74
74
        from loggerhead.config import LoggerheadConfig
75
 
        from loggerhead.main import setup_logging
76
75
 
77
76
        if host is None:
78
77
            host = DEFAULT_HOST
82
81
        if not transport.is_readonly():
83
82
            argv.insert(0, '--allow-writes')
84
83
        config = LoggerheadConfig(argv)
85
 
        setup_logging(config, init_logging=False, log_file=sys.stderr)
86
84
        app = BranchesFromTransportRoot(transport.base, config)
87
85
        app = HTTPExceptionHandler(app)
88
86
        serve(app, host=host, port=port)