~andrewsomething/loggerhead/doc-package

« back to all changes in this revision

Viewing changes to loggerhead/controllers/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-28 09:57:07 UTC
  • mfrom: (182.148.5 upstream)
  • Revision ID: jelmer@samba.org-20110328095707-99a0bszvr75ngnqt
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# along with this program; if not, write to the Free Software
18
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
19
 
 
20
import bzrlib.errors
20
21
import time
21
22
 
 
23
from paste.httpexceptions import HTTPNotFound
22
24
from paste.request import path_info_pop, parse_querystring
23
25
 
24
26
from loggerhead import util
97
99
        if 'Content-Type' not in headers:
98
100
            headers['Content-Type'] = 'text/html'
99
101
        writer = start_response("200 OK", headers.items())
 
102
        if environ.get('REQUEST_METHOD') == 'HEAD':
 
103
            # No content for a HEAD request
 
104
            return []
100
105
        template = load_template(self.template_path)
101
106
        z = time.time()
102
107
        w = BufferingWriter(writer, 8192)
112
117
        if h is None:
113
118
            return None
114
119
        if len(self.args) > 0 and self.args != ['']:
115
 
            return h.fix_revid(self.args[0])
 
120
            try:
 
121
                revid = h.fix_revid(self.args[0])
 
122
            except bzrlib.errors.NoSuchRevision:
 
123
                raise HTTPNotFound;
116
124
        else:
117
 
            return h.last_revid
 
125
            revid = h.last_revid
 
126
        return revid