@view_config(request_method='GET')
    def get_when_not_logged_in(self):
        """
        Handle a request for a user activation link.

        Checks if the activation code passed is valid, and (as a safety check)
        that it is an activation for the passed user id. If all is well,
        activate the user and redirect them to the stream.
        """
        code = self.request.matchdict.get('code')
        id_ = self.request.matchdict.get('id')

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

        activation = Activation.get_by_code(code)
        if activation is None:
            self.request.session.flash(jinja2.Markup(_(
                "We didn't recognize that activation link. "
                "Perhaps you've already activated your account? "
                'If so, try <a href="{url}">signing in</a> using the username '
                'and password that you provided.').format(
                    url=self.request.route_url('login'))),
                'error')
            return httpexceptions.HTTPFound(
                location=self.request.route_url('index'))

        user = User.get_by_activation(activation)
        if user is None or user.id != id_:
            raise httpexceptions.HTTPNotFound()

        user.activate()

        self.request.session.flash(jinja2.Markup(_(
            'Your account has been activated! '
            'You can now <a href="{url}">sign in</a> using the password you '
            'provided.').format(url=self.request.route_url('login'))),
            'success')

        self.request.registry.notify(ActivationEvent(self.request, user))

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