~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/apps/transport.py

  • Committer: Jelmer Vernooij
  • Date: 2009-06-02 00:09:55 UTC
  • mto: (359.3.1 hpss-writes)
  • mto: This revision was merged to the branch mainline in revision 367.
  • Revision ID: jelmer@samba.org-20090602000955-91nohd46pktp8j8k
Support serving branches over HTTP using the smart server protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
"""Serve branches at urls that mimic a transport's file system layout."""
2
2
 
3
3
from bzrlib import branch, errors, lru_cache, urlutils
 
4
from bzrlib.transport import get_transport
 
5
from bzrlib.transport.http import wsgi
4
6
 
5
7
from paste.request import path_info_pop
6
8
from paste import httpexceptions
81
83
            return static_app(environ, start_response)
82
84
        elif environ['PATH_INFO'] == '/favicon.ico':
83
85
            return favicon_app(environ, start_response)
 
86
        elif environ['PATH_INFO'].endswith("/.bzr/smart"):
 
87
            # Only do readonly for now
 
88
            transport = get_transport("readonly+" + self.transport.base)
 
89
            wsgi_app = wsgi.SmartWSGIApp(self.transport)
 
90
            wsgi_app = wsgi.RelpathSetter(wsgi_app, '', 'PATH_INFO')
 
91
            return wsgi_app(environ, start_response)
84
92
        elif '/.bzr/' in environ['PATH_INFO']:
85
93
            # TODO: Use something here that uses the transport API 
86
94
            # rather than relying on the local filesystem API.