summaryrefslogtreecommitdiff
path: root/portato/session.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/session.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/portato/session.py b/portato/session.py
index 0a61181..026c7fc 100644
--- a/portato/session.py
+++ b/portato/session.py
@@ -28,6 +28,9 @@ class Session (object):
want to define boolean values, use 0 and 1. This is future proof.
"""
+ # the current session format version
+ VERSION = 1
+
def __init__ (self, file):
"""
Initialize a session with a certain file inside L{SESSION_DIR.}
@@ -47,6 +50,9 @@ class Session (object):
if e.errno == 2: pass
else: raise
+ # add version check
+ self.add_handler(([("version", "session")], self.check_version, lambda: self.VERSION))
+
def add_handler (self, (options, load_fn, save_fn)):
"""
Adds a handler to this session. A handler is a three-tuple consisting of:
@@ -87,3 +93,6 @@ class Session (object):
self._cfg.add(option, str(value), section = section, with_blankline = False)
self._cfg.write()
+
+ def check_version (self, vers):
+ pass # do nothing atm