~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Martin Albisetti
  • Date: 2008-08-20 22:11:54 UTC
  • mto: This revision was merged to the branch mainline in revision 218.
  • Revision ID: argentina@gmail.com-20080820221154-qxxgkd06k0b4a2wg
Add --prefix option for hosts

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
                      help="Port Loggerhead should listen on. 8080 is the default one.")
45
45
    parser.add_option("--host", dest="user_host",
46
46
                      help="Host Loggerhead should listen on.")
 
47
    parser.add_option("--prefix", dest="user_prefix",
 
48
                      help="Specify host prefix.")
47
49
    parser.add_option("--version", action="store_true", dest="show_version",
48
50
                      help="Print the software version and exit")
49
51
    return parser
86
88
    app = HTTPExceptionHandler(app)
87
89
    app = TransLogger(app)
88
90
 
 
91
    if not options.user_prefix:
 
92
        prefix = '/'
 
93
    else:
 
94
        prefix = options.user_prefix
 
95
 
89
96
    try:
90
97
        from paste.deploy.config import PrefixMiddleware
91
98
    except ImportError:
92
99
        pass
93
100
    else:
94
 
        app = PrefixMiddleware(app)
 
101
        app = PrefixMiddleware(app, prefix=prefix)
95
102
    
96
103
    if not options.user_port:
97
104
        port = '8080'