From 8c5320ff7a2be84e3260ef614059ddc6223d7f30 Mon Sep 17 00:00:00 2001 From: Necoro <> Date: Mon, 14 Jan 2008 22:14:32 +0000 Subject: --- portato/session.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'portato/session.py') 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 -- cgit v1.2.3