[tor-commits] [stem/master] Add stem.util.conf.save()
atagar at torproject.org
atagar at torproject.org
Mon Jan 16 06:27:54 UTC 2012
commit 451e13eb9552ab448072b863b180a338a4baeb24
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date: Sun Jan 15 23:16:06 2012 +0530
Add stem.util.conf.save()
This saves all the contents in the config file.
It overwrites the contents of the original
config file. The comments of the original file
will be lost.
---
stem/util/conf.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/stem/util/conf.py b/stem/util/conf.py
index c226f40..0c98206 100644
--- a/stem/util/conf.py
+++ b/stem/util/conf.py
@@ -439,3 +439,11 @@ class Config():
return default
else: return [int(val) for val in conf_comp]
+ def save(self):
+ self._contents_lock.acquire()
+
+ with open(path, 'w') as f:
+ for entry in self.keys():
+ f.write('%s %s\n' % (entry, self.get(entry)))
+
+ self._contents_lock.release()
More information about the tor-commits
mailing list