Search the list, I posted an exaple a while back.
# Need to clean up all of the wav files created by the user
from MiscUtils.MixIn import MixIn
from WebKit.Session import Session
import os,os.path
class SessionMixIn:
def expiring(self):
print 'session started', self.creationTime()
print 'ending session- removing cgPlayerGeneratedWavs'
if (self.hasValue('cgPlayerGeneratedWavs')):
fileList=self.value('cgPlayerGeneratedWavs')
for f in fileList:
if os.path.isfile(f):
os.remove(f)
# Now inject the methods from SessionMixIn into Session
MixIn(Session, SessionMixIn)
print 'ending session- removing cgPlayerGeneratedWavs'
if (self.hasValue('cgPlayerGeneratedWavs')):
fileList=self.value('cgPlayerGeneratedWavs')
for f in fileList:
if os.path.isfile(f):
os.remove(f)
# Now inject the methods from SessionMixIn into Session
MixIn(Session, SessionMixIn)
jose@... wrote:
>HI all.
>
>Can someone please tell me how I can access a session variable via a task?
>What I need to do is to do some file house keeping once a session expires.
>I thought I could do this by using MixIn and simply over riding the
>expiring method within a context, but it seems the this over rides the
>method for the all contexts (not really what I had in mind). So now the
>only thing I can think of is to use Tasks, but I am at a loss as to how to
>proceed. Any and all help would be much appreciated
>
>Thanks
>
>Jose
>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: ObjectStore.
>If flattening out C++ or Java code to make your application fit in a
>relational database is painful, don't do it! Check out ObjectStore.
>Now part of Progress Software. http://www.objectstore.net/sourceforge
>_______________________________________________
>Webware-discuss mailing list
>Webware-discuss@...
>https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
>
|