[tor-commits] [ooni-probe/master] Fix bug when pushing to stack that is of the format a.b.c.$idx
art at torproject.org
art at torproject.org
Sat Dec 8 19:12:41 UTC 2012
commit 91c240a3ce497d3ec240b1b69398e043f7e12e4d
Author: Arturo Filastò <art at fuffa.org>
Date: Sat Dec 8 20:13:57 2012 +0100
Fix bug when pushing to stack that is of the format a.b.c.$idx
* XXX write unittest
---
ooni/utils/__init__.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ooni/utils/__init__.py b/ooni/utils/__init__.py
index baf3f39..8510a3b 100644
--- a/ooni/utils/__init__.py
+++ b/ooni/utils/__init__.py
@@ -105,7 +105,8 @@ def pushFilenameStack(filename):
"""
stack = glob.glob(filename+".*")
for f in reversed(stack):
- c_filename, c_idx = f.split(".")
+ c_idx = f.split(".")[-1]
+ c_filename = '.'.join(f.split(".")[:-1])
new_idx = int(c_idx) + 1
new_filename = "%s.%s" % (c_filename, new_idx)
os.rename(f, new_filename)
More information about the tor-commits
mailing list