Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8400305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:31:54+00:00 2026-06-09T21:31:54+00:00

Or do I misunderstand how destroying work? Here’s an example code: class TestHandler(BaseHandler): def

  • 0

Or do I misunderstand how destroying work? Here’s an example code:

class TestHandler(BaseHandler):
    def get(self):
        counter = self.session.get('counter')
        if not counter:
            counter = 0
        counter += 1

        if counter > 5:
            self.auth.unset_session()
        else:
            self.session['counter'] = counter

        return self.response.write ( counter )

Session works, the counter counts, but either session isn’t destroyed or destroying it doesn’t null the value?

Does destroying null only some values like userid and sessionid or do I completely miss the point? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:31:56+00:00Added an answer on June 9, 2026 at 9:31 pm

    unset_session removes the user from the session not the other session variables. The unset_session method is on the auth module.

    If you dig a little deeper in the code you can have a look at what the code is doing.
    http://code.google.com/p/webapp-improved/source/browse/webapp2_extras/auth.py

     def unset_session(self):
            """Removes a user from the session and invalidates the auth token."""
            self._user = None
            data = self.get_session_data(pop=True)
            ....
    

    If you were trying to unset the counter, you could pop the session variable by calling self.session.pop(‘counter’)

    For example:

       counter = self.session.get('counter')
        if not counter:
            counter = 0
        counter += 1
    
        if counter > 5:
            self.session.pop('counter')
        else:
            self.session['counter'] = counter
    
        return self.response.write ( counter )
    

    If you want to clear everything from the session, you can call self.session.clear()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe I misunderstand how CSS Conditional Comments work, but I thought the bit in
Example here: http://jsfiddle.net/KyW6c/2/ I have an ordered list. Each list item is a project
hey guys, what do I misunderstand here? $dir = get_bloginfo('template_url').'/images/headers/'; echo $dir; //ouput: myblog.com/wp-content/themes/mytheme/images/headers
I don't see what's wrong here, but I may just misunderstand the syntax. I'm
I think I may misunderstand why the with command is used. But can any
I seem to misunderstand a basic syntax, why this sample works: sqlite3_prepare_v2(db, insert into
I'm new to MVC2 in ASP.NET/C#, so please forgive me if I misunderstand something.
I meet this problem when implementing my own swap() method with Python def swap(a,b):
I'm not entirely sure which part of my code is making this happen. This
Is there a way to implement operator->, not only operator*. To have following code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.