~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/dispatch/request.py

  • Committer: matt.giuca
  • Date: 2009-02-02 22:27:12 UTC
  • Revision ID: svn-v4:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1191
tutorial: Fixed use of wrong variable names (broke during refactor).

Show diffs side-by-side

added added

removed removed

Lines of Context:
267
267
            # This includes binary strings.
268
268
            self.apache_req.write(string, flush)
269
269
 
 
270
    def logout(self):
 
271
        """Log out the current user by destroying the session state.
 
272
        Then redirect to the top-level IVLE page."""
 
273
        # List of cookies that IVLE uses (to be removed at logout)
 
274
        ivle_cookies = ["ivleforumcookie", "clipboard"]
 
275
        
 
276
        if hasattr(self, 'session'):
 
277
            self.session.invalidate()
 
278
            self.session.delete()
 
279
            # Invalidates all IVLE cookies
 
280
            all_cookies = Cookie.get_cookies(self)
 
281
            for cookie in all_cookies:
 
282
                if cookie in ivle_cookies:
 
283
                    self.add_cookie(Cookie.Cookie(cookie,'',expires=1,path='/'))
 
284
        self.throw_redirect(ivle.util.make_path('')) 
 
285
 
 
286
 
270
287
    def flush(self):
271
288
        """Flushes the output buffer."""
272
289
        self.apache_req.flush()