[Inteproxy-commits] r340 - in trunk: . inteproxy test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 12 10:22:59 CET 2012


Author: teichmann
Date: 2012-01-12 10:22:49 +0100 (Thu, 12 Jan 2012)
New Revision: 340

Modified:
   trunk/ChangeLog
   trunk/inteproxy/proxycore.py
   trunk/test/test_chunkedwriter.py
Log:
Re-establish Python 2.4 compatiblility

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2012-01-11 11:22:46 UTC (rev 339)
+++ trunk/ChangeLog	2012-01-12 09:22:49 UTC (rev 340)
@@ -1,3 +1,8 @@
+2012-01-12	Sascha L. Teichmann	<sascha.teichmann at intevation.de>
+
+	* inteproxy/proxycore.py, test/test_chunkedwriter.py: 
+	  Replaced if/else with Python 2.4 compatible constructs.
+
 2012-01-11	Bjoern Schilberg	<bjoern.schilberg at intevation.de>
 	Bumped version to 1.1.0.
 

Modified: trunk/inteproxy/proxycore.py
===================================================================
--- trunk/inteproxy/proxycore.py	2012-01-11 11:22:46 UTC (rev 339)
+++ trunk/inteproxy/proxycore.py	2012-01-12 09:22:49 UTC (rev 340)
@@ -396,7 +396,10 @@
                     rewritten = None
                     pos = idx+1
                 else:
-                    append(chunk[pos:] if pos else chunk)
+                    if pos:
+                        append(chunk[pos:])
+                    else:
+                        append(chunk)
                     break
 
         rewritten = rewrite(''.join(data))

Modified: trunk/test/test_chunkedwriter.py
===================================================================
--- trunk/test/test_chunkedwriter.py	2012-01-11 11:22:46 UTC (rev 339)
+++ trunk/test/test_chunkedwriter.py	2012-01-12 09:22:49 UTC (rev 340)
@@ -35,9 +35,10 @@
         randint, rand = r.randint, r.random
         rest = len(source)
         while rest:
-            to_write = (randint(1, SMALL) 
-                        if rand() < 0.7
-                        else randint(CHUNK-SMALL, CHUNK+SMALL))
+            if rand() < 0.7:
+                to_write = randint(1, SMALL)
+            else:
+                to_write = randint(CHUNK-SMALL, CHUNK+SMALL)
             to_write = min(rest, to_write)
             p = len(source)-rest
             writer.append(source[p:p+to_write])



More information about the Inteproxy-commits mailing list