summaryrefslogtreecommitdiff
path: root/portato/session.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-04-09 23:43:44 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-04-09 23:43:44 +0200
commitd8c4bacde00e2be0e5d5aaf7f85f139aae6a95d6 (patch)
tree12f088e6c07b690cccbcc073b744dc5760713918 /portato/session.py
parent3cc84485184c1662fabb53f35df43a539021ff93 (diff)
parent359309950a1283dbbf9df6ce1085838087cfc262 (diff)
downloadportato-no_config.tar.gz
portato-no_config.tar.bz2
portato-no_config.zip
Merge branch 'master' into no_config to pickup the recent changes andno_config
fixes. Conflicts: portato/db/__init__.py portato/session.py
Diffstat (limited to 'portato/session.py')
-rw-r--r--portato/session.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/portato/session.py b/portato/session.py
index be13275..ebf49af 100644
--- a/portato/session.py
+++ b/portato/session.py
@@ -28,9 +28,6 @@ class Session (object):
A small class allowing to save certain states of a program.
This class works in a quite abstract manner, as it works with handlers, which
define what options to use out of the config file and how to apply them to the program.
-
- Note: This class currently does not work with boolean config options. If you
- want to define boolean values, use 0 and 1. This is future proof.
"""
# the current session format version
@@ -159,6 +156,15 @@ class Session (object):
return self._cfg.get(section, key)
except NoSuchThing:
return None
+
+ def get_bool (self, key, section = None):
+ if section is None: section = self._name
+ section = section.upper()
+
+ try:
+ return self._cfg.getboolean(section, key)
+ except NoSuchThing, ValueError:
+ return None
def remove (self, key, section = None):
if section is None: section = self._name