@@ -182,7 +182,7 @@ def destroy(self):
182182 self .client .add_cookie (self .cookie_name , None )
183183 self ._data = {}
184184 self .session_db .destroy (self ._sid )
185- self .client . db .commit ()
185+ self .session_db .commit ()
186186
187187 def get (self , name , default = None ):
188188 return self ._data .get (name , default )
@@ -200,7 +200,7 @@ def set(self, **kwargs):
200200 self .client .session = self ._sid
201201 else :
202202 self .session_db .set (self ._sid , ** self ._data )
203- self .client . db .commit ()
203+ self .session_db .commit ()
204204
205205 def update (self , set_cookie = False , expire = None ):
206206 """ update timestamp in db to avoid expiration
@@ -212,7 +212,7 @@ def update(self, set_cookie=False, expire=None):
212212 lifetime is longer
213213 """
214214 self .session_db .updateTimestamp (self ._sid )
215- self .client . db .commit ()
215+ self .session_db .commit ()
216216
217217 if set_cookie :
218218 self .client .add_cookie (self .cookie_name , self ._sid , expire = expire )
@@ -697,14 +697,15 @@ def clean_up(self):
697697
698698 # XXX: hack - use OTK table to store last_clean time information
699699 # 'last_clean' string is used instead of otk key
700- last_clean = self .db .getOTKManager ().get ('last_clean' , 'last_use' , 0 )
700+ otks = self .db .getOTKManager ()
701+ last_clean = otks .get ('last_clean' , 'last_use' , 0 )
701702 if now - last_clean < hour :
702703 return
703704
704705 self .session_api .clean_up ()
705- self . db . getOTKManager () .clean ()
706- self . db . getOTKManager () .set ('last_clean' , last_use = now )
707- self . db . commit (fail_ok = True )
706+ otks .clean ()
707+ otks .set ('last_clean' , last_use = now )
708+ otks . commit ()
708709
709710 def determine_charset (self ):
710711 """Look for client charset in the form parameters or browser cookie.
@@ -982,7 +983,7 @@ def handle_csrf(self, xmlrpc=False):
982983 self ._ ("csrf key used with wrong method from: %s" ),
983984 referer )
984985 otks .destroy (key )
985- self . db .commit ()
986+ otks .commit ()
986987 # do return here. Keys have been obsoleted.
987988 # we didn't do a expire cycle of session keys,
988989 # but that's ok.
@@ -1105,7 +1106,7 @@ def handle_csrf(self, xmlrpc=False):
11051106
11061107 if xmlrpc :
11071108 # Save removal of expired keys from database.
1108- self . db .commit ()
1109+ otks .commit ()
11091110 # Return from here since we have done housekeeping
11101111 # and don't use csrf tokens for xmlrpc.
11111112 return True
@@ -1125,7 +1126,7 @@ def handle_csrf(self, xmlrpc=False):
11251126 otks .destroy (key )
11261127
11271128 # commit the deletion/expiration of all keys
1128- self . db .commit ()
1129+ otks .commit ()
11291130
11301131 enforce = config ['WEB_CSRF_ENFORCE_TOKEN' ]
11311132 if key is None : # we do not have an @csrf token
@@ -1172,7 +1173,7 @@ def handle_csrf(self, xmlrpc=False):
11721173 self.form["@action"].value == "Login":
11731174 if header_pass > 0:
11741175 otks.destroy(key)
1175- self.db .commit()
1176+ otks .commit()
11761177 return True
11771178 else:
11781179 self.add_error_message("Reload window before logging in.")
0 commit comments