'Overriding to produce a different redirect_uri'

def login_url(self, next='/'):

    if (not self.accessToken()):
        request = current.request
        if (not request.vars.code):
            session = current.session
            session.redirect_uri = self.args['redirect_uri']
            data = {'redirect_uri': session.redirect_uri, 'response_type': 'code', 'client_id': self.client_id}
            if self.args:
                data.update(self.args)
            auth_request_url = ('%s?%s' % (self.auth_url, urllib.urlencode(data)))
            raise HTTP(307, (REDIRECT_MSG % auth_request_url), Location=auth_request_url)
        else:
            current.session.code = request.vars.code
            self.accessToken()
    return next
