@view_config(request_method='GET',
                 effective_principals=security.Authenticated)
    def get_when_logged_in(self):
        """Handle an activation link request while already logged in."""
        id_ = self.request.matchdict.get('id')

        try:
            id_ = int(id_)
        except __HOLE__:
            raise httpexceptions.HTTPNotFound()

        if id_ == self.request.authenticated_user.id:
            # The user is already signed in to the account (so the account
            # must already be activated).
            self.request.session.flash(jinja2.Markup(_(
                "Your account has been activated and you're now signed "
                "in!")), 'success')
        else:
            self.request.session.flash(jinja2.Markup(_(
                "You're already signed in to a different account. "
                '<a href="{url}">Sign out</a> then try opening the '
                'activation link again.').format(
                    url=self.request.route_url('logout'))),
                'error')

        return httpexceptions.HTTPFound(
            location=self.request.route_url('index'))
dataset/ETHPy150Open hypothesis/h/h/accounts/views.py/ActivateController.get_when_logged_in