comparison mercurial/hgweb/hgweb_mod.py @ 6785:4879468fa28f

hgweb: return content iterator instead of using write() callable
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sun, 29 Jun 2008 22:36:18 +0200
parents 18c429ea3a0e
children 943f066c0d58
comparison
equal deleted inserted replaced
6784:18c429ea3a0e 6785:4879468fa28f
167 content = getattr(webcommands, cmd)(self, req, tmpl) 167 content = getattr(webcommands, cmd)(self, req, tmpl)
168 req.respond(HTTP_OK, ctype) 168 req.respond(HTTP_OK, ctype)
169 169
170 req.write(content) 170 req.write(content)
171 del tmpl 171 del tmpl
172 return req 172 return ''.join(content),
173 173
174 except revlog.LookupError, err: 174 except revlog.LookupError, err:
175 req.respond(HTTP_NOT_FOUND, ctype) 175 req.respond(HTTP_NOT_FOUND, ctype)
176 msg = str(err) 176 msg = str(err)
177 if 'manifest' not in msg: 177 if 'manifest' not in msg:
178 msg = 'revision not found: %s' % err.name 178 msg = 'revision not found: %s' % err.name
179 req.write(tmpl('error', error=msg)) 179 return ''.join(tmpl('error', error=msg)),
180 except (RepoError, revlog.RevlogError), inst: 180 except (RepoError, revlog.RevlogError), inst:
181 req.respond(HTTP_SERVER_ERROR, ctype) 181 req.respond(HTTP_SERVER_ERROR, ctype)
182 req.write(tmpl('error', error=str(inst))) 182 return ''.join(tmpl('error', error=str(inst))),
183 except ErrorResponse, inst: 183 except ErrorResponse, inst:
184 req.respond(inst.code, ctype) 184 req.respond(inst.code, ctype)
185 req.write(tmpl('error', error=inst.message)) 185 return ''.join(tmpl('error', error=inst.message)),
186 186
187 def templater(self, req): 187 def templater(self, req):
188 188
189 # determine scheme, port and server name 189 # determine scheme, port and server name
190 # this is needed to create absolute urls 190 # this is needed to create absolute urls