summaryrefslogtreecommitdiff
path: root/SoftwareProperties
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-01-05 12:38:07 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-01-05 12:38:07 +0100
commitd7093cd4e9873a637da1ea81facad09c2d735879 (patch)
tree974be45c943eb05f64e99790b4b9dc5134c6e84b /SoftwareProperties
parent03bd067035e507e4dad0325775c14c3afc09dc18 (diff)
downloadpython-apt-d7093cd4e9873a637da1ea81facad09c2d735879.tar.gz
* fix a indention that lead to absurdly large file in /etc/apt/apt.conf.d/10periodic
Diffstat (limited to 'SoftwareProperties')
-rw-r--r--SoftwareProperties/SoftwareProperties.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index db9e3e26..3572e8e8 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -64,7 +64,7 @@ class SoftwareProperties(SimpleGladeApp):
SimpleGladeApp.__init__(self, datadir+"glade/SoftwareProperties.glade",
None, domain="update-manager")
self.modified = False
-
+
self.gnome_program = gnome.init("Software Properties", "0.41")
self.gconfclient = gconf.client_get_default()
@@ -156,25 +156,28 @@ class SoftwareProperties(SimpleGladeApp):
self.write_config()
def write_config(self):
+ #print "write_config()"
periodic = "/etc/apt/apt.conf.d/10periodic"
-
+
+ # read the old content
content = []
-
if os.path.isfile(periodic):
content = open(periodic, "r").readlines()
-
- cnf = apt_pkg.Config.SubTree("APT::Periodic")
- f = open(periodic, "w+")
+ cnf = apt_pkg.Config.SubTree("APT::Periodic")
+
+ # write a new file without the updated keys
+ f = open(periodic, "w")
for line in content:
found = False
for key in cnf.List():
if line.find("APT::Periodic::%s" % (key)) >= 0:
found = True
break
- if not found:
- f.write(line)
-
+ if not found:
+ f.write(line)
+
+ # append the updated keys
for i in cnf.List():
f.write("APT::Periodic::%s \"%s\";\n" % (i, cnf.FindI(i)))
f.close()