@@ -15,14 +15,16 @@ class SessionMemoryStore(SessionStore):
1515
1616 ## Init ##
1717
18- def __init__ (self , app , restoreFiles = True ):
18+ def __init__ (self , app , restoreFiles = None ):
1919 """Initialize the session memory store.
2020
2121 If restoreFiles is true, and sessions have been saved to file,
2222 the store will be initialized from these files.
2323 """
2424 SessionStore .__init__ (self , app )
2525 self ._store = {}
26+ if restoreFiles is None :
27+ restoreFiles = self ._retain
2628 if restoreFiles :
2729 filestore = SessionFileStore (app )
2830 for key in filestore :
@@ -31,6 +33,7 @@ def __init__(self, app, restoreFiles=True):
3133 except Exception :
3234 app .handleException ()
3335 filestore .clear ()
36+ self ._restoreFiles = restoreFiles
3437
3538
3639 ## Access ##
@@ -96,6 +99,7 @@ def storeSession(self, session):
9699
97100 def storeAllSessions (self ):
98101 """Permanently save all sessions in the store."""
99- filestore = SessionFileStore (self ._app )
100- for key , session in self .items ():
101- filestore [key ] = session
102+ if self ._restoreFiles :
103+ filestore = SessionFileStore (self ._app )
104+ for key , session in self .items ():
105+ filestore [key ] = session
0 commit comments