def logout(self): self.request.registry.notify(LogoutEvent(self.request)) self.request.session.invalidate() self.request.session.flash(_('You have logged out.'), 'success') headers = forget(self.request) return httpexceptions.HTTPFound(location=self.logout_redirect, headers=headers)
def _logout(self): if self.request.authenticated_userid is not None: self.request.registry.notify(LogoutEvent(self.request)) self.request.session.invalidate() headers = security.forget(self.request) return headers