summaryrefslogtreecommitdiff
path: root/portato/session.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-01-27 21:05:55 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-01-27 21:05:55 +0100
commitb7b78173b6b2d8eb6f7d5260868cf5efdc1d7ca0 (patch)
treef25b4ec4354002bd596babf468fd6c16e58a6b6b /portato/session.py
parent8f00e1610d8bf53e102c20d140fa1907a73b6a48 (diff)
downloadportato-b7b78173b6b2d8eb6f7d5260868cf5efdc1d7ca0.tar.gz
portato-b7b78173b6b2d8eb6f7d5260868cf5efdc1d7ca0.tar.bz2
portato-b7b78173b6b2d8eb6f7d5260868cf5efdc1d7ca0.zip
Add rename functions
Diffstat (limited to 'portato/session.py')
-rw-r--r--portato/session.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/portato/session.py b/portato/session.py
index 31aba16..a4b929b 100644
--- a/portato/session.py
+++ b/portato/session.py
@@ -176,5 +176,18 @@ class Session (object):
del self._cfg.cache[sline:mline+1]
self._cfg.write()
+ def rename (self, old, new, section = ""):
+ if not section: section = self._name
+
+ val = self.get(old, section)
+ self.remove(old, section)
+ self._cfg.add(new, val, section, with_blankline = False)
+
+ def rename_section (self, old, new):
+ old = old.upper()
+ line = self._cfg.sections[old]
+ self._cfg.cache[line] = "[%s]\n" % new.upper()
+ self._cfg.write()
+
def check_version (self, vers):
pass # do nothing atm