[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [pytorctl/master 1/2] Fix Python 2.4 compatibility.



Author: Harry Bock <hbock@xxxxxxxxxxx>
Date: Sun, 22 Aug 2010 22:13:36 -0400
Subject: Fix Python 2.4 compatibility.
Commit: 15681037f939aea3dec625615401fd13435f1cc9

Commit 33bf5a0a4a9 broke python 2.4 compat by using string.partition(),
introduced in Python 2.5.  Use string.split() instead.
---
 TorCtl.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/TorCtl.py b/TorCtl.py
index 8aa498b..01e0949 100755
--- a/TorCtl.py
+++ b/TorCtl.py
@@ -384,13 +384,16 @@ class Router:
 
     for line in desc:
       # Pull off the keyword...
-      kw, _, rest = line.partition(" ")
+      sp = line.split(" ", 1)
+      kw = sp[0]
+      rest = sp[1] if len(sp) > 1 else ""
 
       # ...and if it's "opt", extend it by the next keyword
       # so we get "opt hibernating" as one keyword.
       if kw == "opt":
-        okw, _, rest = rest.partition(" ")
-        kw += " " + okw
+        sp = rest.split(" ", 1)
+        rest = sp[1] if len(sp) > 1 else ""
+        kw += " " + sp[0]
 
       # try to match the descriptor line by keyword.
       try:
-- 
1.7.1