changeset 397:5b078a6d8909

new toggle option method
author casties
date Mon, 08 Nov 2010 17:08:18 +0100
parents 28a03e25a0e8
children 55f9eeebc338
files documentViewer.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Mon Nov 08 16:06:59 2010 +0100
+++ b/documentViewer.py	Mon Nov 08 17:08:18 2010 +0100
@@ -411,11 +411,11 @@
 
     def getOptionToggle(self, newState=None, optionName='text_options_open', initialState=True):
         """returns new option state"""
-        opt = self.REQUEST.SESSION.get(optionName,None)
-        if opt is None:
+        if not self.REQUEST.SESSION.has_key(optionName):
             # not in session -- initial
             opt = {'lastState': newState, 'state': initialState}
         else:
+            opt = self.REQUEST.SESSION.get(optionName)
             if opt['lastState'] != newState:
                 # state in session has changed -- toggle
                 opt['state'] = not opt['state']