summaryrefslogtreecommitdiff
path: root/portato/session.py
diff options
context:
space:
mode:
authorNecoro <>2008-01-14 22:14:32 +0000
committerNecoro <>2008-01-14 22:14:32 +0000
commit8c5320ff7a2be84e3260ef614059ddc6223d7f30 (patch)
tree231652506e35e01d1b4f3b451409c08bf750f838 /portato/session.py
parent1f2f723d4f380055e078eb780267ad563158c65d (diff)
downloadportato-8c5320ff7a2be84e3260ef614059ddc6223d7f30.tar.gz
portato-8c5320ff7a2be84e3260ef614059ddc6223d7f30.tar.bz2
portato-8c5320ff7a2be84e3260ef614059ddc6223d7f30.zip
Diffstat (limited to 'portato/session.py')
-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