changeset 6788:88a1bcc5c6a7

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.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 30 Jun 2008 10:36:45 +0200
parents dbb00e91c327
children b2c4be19d7b1
files mercurial/hgweb/protocol.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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)