# HG changeset patch # User Dirkjan Ochtman # Date 1214815005 -7200 # Node ID 88a1bcc5c6a7b1729eb97d0509531c0f9f4a606e # Parent dbb00e91c32779b5c2f14ecd78032ac8af47bbd8 hgweb: use a single-element tuple to return from protocol.unbundle() Python 2.3/2.4 don't support yielding from inside try/finally blocks. diff -r dbb00e91c327 -r 88a1bcc5c6a7 mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py Sun Jun 29 23:02:02 2008 +0200 +++ b/mercurial/hgweb/protocol.py Mon Jun 30 10:36:45 2008 +0200 @@ -124,8 +124,7 @@ # response when run outside cgi script pass req.respond(HTTP_OK, HGTYPE) - yield errorfmt % 'unsynced changes' - return + return errorfmt % 'unsynced changes', req.respond(HTTP_OK, HGTYPE) @@ -143,8 +142,7 @@ lock = repo.lock() try: if not check_heads(): - yield errorfmt % 'unsynced changes' - return + return errorfmt % 'unsynced changes', fp.seek(0) header = fp.read(6) @@ -170,11 +168,11 @@ finally: val = sys.stdout.getvalue() sys.stdout, sys.stderr = oldio - yield '%d\n%s' % (ret, val) + return '%d\n%s' % (ret, val), finally: del lock except ValueError, inst: - yield errorfmt % inst + return errorfmt % inst, except (OSError, IOError), inst: filename = getattr(inst, 'filename', '') # Don't send our filesystem layout to the client @@ -188,7 +186,7 @@ else: code = HTTP_SERVER_ERROR req.respond(code) - yield '0\n%s: %s\n' % (error, filename) + return '0\n%s: %s\n' % (error, filename), finally: fp.close() os.unlink(tempname)