Merge lp://staging/~mnordhoff/loggerhead/serve_branches_robots.txt into lp://staging/loggerhead

Proposed by Matt Nordhoff
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~mnordhoff/loggerhead/serve_branches_robots.txt
Merge into: lp://staging/loggerhead
Diff against target: 30 lines (+5/-1)
1 file modified
loggerhead/apps/transport.py (+5/-1)
To merge this branch: bzr merge lp://staging/~mnordhoff/loggerhead/serve_branches_robots.txt
Reviewer Review Type Date Requested Status
Martin Albisetti Approve
Review via email: mp+15262@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

Loggerhead is supposed to support serving /robots.txt. This worked with loggerhead.apps.config, but it wasn't wired in to loggerhead.apps.transport.

I also added a little WSGI wrapper doodad to convert ENOENT and EACCES to HTTPNotFound and HTTPForbidden, respectively, so that users will get a nice 404 instead of an Internal Server Error if the file doesn't actually exist.

...But LP hasn't mirrored that bit yet. Arrgh. Here's the diff for that:

<http://bzr.mattnordhoff.com/loggerhead/loggerhead/serve_branches_robots.txt/revision/395>

This change works and all. I'd land it myself, but I want to confirm that my WSGI wrapper isn't _too_ ugly. :)

Revision history for this message
Martin Albisetti (beuno) wrote :

Looks good to me. Thanks, and land!

review: Approve

Updating diff...

An updated diff will be available in a few minutes. Reload to see the changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/apps/transport.py'
2--- loggerhead/apps/transport.py 2009-10-21 14:34:51 +0000
3+++ loggerhead/apps/transport.py 2009-11-26 03:50:22 +0000
4@@ -29,7 +29,7 @@
5 from paste import urlparser
6
7 from loggerhead.apps.branch import BranchWSGIApp
8-from loggerhead.apps import favicon_app, static_app
9+from loggerhead.apps import favicon_app, robots_app, static_app
10 from loggerhead.controllers.directory_ui import DirectoryUI
11
12 _bools = {
13@@ -158,6 +158,8 @@
14 return static_app(environ, start_response)
15 elif environ['PATH_INFO'] == '/favicon.ico':
16 return favicon_app(environ, start_response)
17+ elif environ['PATH_INFO'] == '/robots.txt':
18+ return robots_app(environ, start_response)
19 else:
20 transport = get_transport_for_thread(self.base)
21 return BranchesFromTransportServer(
22@@ -182,6 +184,8 @@
23 return static_app(environ, start_response)
24 elif path_info == '/favicon.ico':
25 return favicon_app(environ, start_response)
26+ elif environ['PATH_INFO'] == '/robots.txt':
27+ return robots_app(environ, start_response)
28 else:
29 transport = get_transport_for_thread(self.base)
30 # segments starting with ~ are user branches

Subscribers

People subscribed via source and target branches