Mercurial > hg
comparison mercurial/hgweb/server.py @ 8663:45f626a39def
wrap string literals in error messages
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sun, 31 May 2009 01:30:16 +0200 |
parents | 46293a0c7e9f |
children | a232b90ffb51 |
comparison
equal
deleted
inserted
replaced
8662:eaee3491ce11 | 8663:45f626a39def |
---|---|
67 self.do_write() | 67 self.do_write() |
68 except StandardError: | 68 except StandardError: |
69 self._start_response("500 Internal Server Error", []) | 69 self._start_response("500 Internal Server Error", []) |
70 self._write("Internal Server Error") | 70 self._write("Internal Server Error") |
71 tb = "".join(traceback.format_exception(*sys.exc_info())) | 71 tb = "".join(traceback.format_exception(*sys.exc_info())) |
72 self.log_error("Exception happened during processing request '%s':\n%s", | 72 self.log_error("Exception happened during processing " |
73 self.path, tb) | 73 "request '%s':\n%s", self.path, tb) |
74 | 74 |
75 def do_GET(self): | 75 def do_GET(self): |
76 self.do_POST() | 76 self.do_POST() |
77 | 77 |
78 def do_hgweb(self): | 78 def do_hgweb(self): |
124 for chunk in self.server.application(env, self._start_response): | 124 for chunk in self.server.application(env, self._start_response): |
125 self._write(chunk) | 125 self._write(chunk) |
126 | 126 |
127 def send_headers(self): | 127 def send_headers(self): |
128 if not self.saved_status: | 128 if not self.saved_status: |
129 raise AssertionError("Sending headers before start_response() called") | 129 raise AssertionError("Sending headers before " |
130 "start_response() called") | |
130 saved_status = self.saved_status.split(None, 1) | 131 saved_status = self.saved_status.split(None, 1) |
131 saved_status[0] = int(saved_status[0]) | 132 saved_status[0] = int(saved_status[0]) |
132 self.send_response(*saved_status) | 133 self.send_response(*saved_status) |
133 should_close = True | 134 should_close = True |
134 for h in self.saved_headers: | 135 for h in self.saved_headers: |
161 raise AssertionError("data written before start_response() called") | 162 raise AssertionError("data written before start_response() called") |
162 elif not self.sent_headers: | 163 elif not self.sent_headers: |
163 self.send_headers() | 164 self.send_headers() |
164 if self.length is not None: | 165 if self.length is not None: |
165 if len(data) > self.length: | 166 if len(data) > self.length: |
166 raise AssertionError("Content-length header sent, but more bytes than specified are being written.") | 167 raise AssertionError("Content-length header sent, but more " |
168 "bytes than specified are being written.") | |
167 self.length = self.length - len(data) | 169 self.length = self.length - len(data) |
168 self.wfile.write(data) | 170 self.wfile.write(data) |
169 self.wfile.flush() | 171 self.wfile.flush() |
170 | 172 |
171 class _shgwebhandler(_hgwebhandler): | 173 class _shgwebhandler(_hgwebhandler): |