commit 91c240a3ce497d3ec240b1b69398e043f7e12e4d Author: Arturo Filastò art@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)