def validate_code(self, client_id, code, client, request, *args, **kwargs):
        client = client or self._clientgetter(client_id)
        log.debug(
            'Validate code for client %r and code %r', client.client_id, code
        )
        grant = self._grantgetter(client_id=client.client_id, code=code)
        if not grant:
            log.debug('Grant not found.')
            return False
        if hasattr(grant, 'expires') and \
           datetime.datetime.utcnow() > grant.expires:
            log.debug('Grant is expired.')
            return False

        request.state = kwargs.get('state')
        request.user = grant.user
        request.scopes = grant.scopes
        return True
Generate URL for the view. Override to change default behavior.
dataset/ETHPy150Open codalab/codalab-cli/codalab/server/oauth2_provider.py/OAuth2RequestValidator.validate_code--crossover with--dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/base.py/BaseView._get_view_url