Пример #1
0
    def render(self):
        session = ISession(self.request, None)

        if 'testsessionkey' in self.request:
            session['testsessionkey'] = dict(key1='Hey', key2='Boy')
            session.save()
            return 'Test key stored...'

        if 'testsessionkey2' in self.request:
            session['testsessionkey2'] = dict(key1='Hey', key2='Boy')
            session.save()
            return 'Test key2 stored...'


        if 'remove' in self.request:
            session.delete()
            session.invalidate()
            return 'Session removed and destroyed...'

        if session is None:
            return 'No session initiatied'
        if 'testsessionkey' in session:
            return 'Found session: ' + str(session)
        else:
            return 'Did not find testsessionkey in session...'
Пример #2
0
    def test_deleted(self):
        provideAdapter(testingSession)

        request = TestRequest()
        session = ISession(request)

        self.assertEquals(False, session._deleted)
        session.delete()
        self.assertEquals(True, session._deleted)
Пример #3
0
    def resetCredentials(self, request, response):
        """This method is called if the user logs out.
Here, we simply destroy their session.
"""
        session = ISession(request, None)
        if session is None:
            return

        session.delete()
Пример #4
0
    def resetCredentials(self, request, response):
        """This method is called if the user logs out.
Here, we simply destroy their session.
"""
        session = ISession(request, None)
        if session is None:
            return

        session.delete()
Пример #5
0
 def __call__(self):
     session = ISession(self.request)
     if 'reset' in self.request:
         session['testCounter'] = 0
         session.save()
     if 'increment' in self.request:
         session['testCounter'] += 1
         session.save()
     if 'invalidate' in self.request:
         session.invalidate()
     if 'delete' in self.request:
         session.delete()
     return str(session.get('testCounter', -1))
Пример #6
0
def delSessionData(request):
    """
    Loescht das Cookie
    """
    data = {'hhlpan':False,
            'taetigkeit':{},
            'chemiesuche':{},
            'mechaniksuche':{},
            'schutzhandschuhe':[],
            'hautschutz':[],
            'hautreinigung':[],
            'hautpflege':[],
            'desinfektion':[],
            'hautschutzplan':{}}
    insert = setSessionData(request, data)
    session = ISession(request)
    session.delete()
Пример #7
0
def delSessionData(request):
    """
    Loescht das Cookie
    """
    session = ISession(request)
    session.delete()