From bbcd2c8be1bd2ce4681a80c82bbb00ac04137505 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 3 Sep 2005 01:13:53 +0000 Subject: - adding netmask to network setup - writing network config (to /etc/network/interfaces.tmp for now) - adding magic to config.py --- lib/python/Components/config.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/python/Components/config.py') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 1795d426..2fd0ff15 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -128,7 +128,8 @@ class configSequence: if diff > 0: value += " " * diff value += str(i) - +# or the above code if you have to spare ink +# value = ((len(self.parent.value) * ("%0" + str(self.parent.vals[1]) + "d" + self.parent.vals[0]))[0:-1]) % tuple(self.parent.value) value = value[0:mPos] + "_" + value[mPos + 1:] return ("text", value) @@ -203,11 +204,13 @@ class configElement: elif control == configSelection: return str(data); elif control == configSequence: - value = "" - for i in data: - if value !="": - value += self.vals[0] - value += str(i) + value = ((len(data) * ("%d" + self.vals[0]))[0:-1]) % tuple(data) +# just in case you don't understand the above, here an equivalent: +# value = "" +# for i in data: +# if value !="": +# value += self.vals[0] +# value += str(i) return value else: return "" -- cgit v1.2.3