def render_exception(error, user_locale=None): """Forms a WSGI response based on the current error.""" body = {'error': { 'code': error.code, 'title': error.title, 'message': unicode(gettextutils.get_localized_message(error.args[0], user_locale)), }} if isinstance(error, exception.AuthPluginException): body['error']['identity'] = error.authentication return render_response(status=(error.code, error.title), body=body)
def render_exception(error, user_locale=None): """Forms a WSGI response based on the current error.""" body = {'error': { 'code': error.code, 'title': error.title, 'message': unicode(gettextutils.get_localized_message(error.args[0], user_locale)), }} if isinstance(error, exception.AuthPluginException): body['error']['identity'] = error.authentication return render_response(status=(error.code, error.title), body=body)
def render_exception(error, user_locale=None): """Forms a WSGI response based on the current error.""" body = {'error': { 'code': error.code, 'title': error.title, 'message': unicode(gettextutils.get_localized_message(error.args[0], user_locale)), }} headers = [] if isinstance(error, exception.AuthPluginException): body['error']['identity'] = error.authentication elif isinstance(error, exception.Unauthorized): headers.append(('WWW-Authenticate', 'Keystone uri="%s"' % ( CONF.public_endpoint % CONF))) return render_response(status=(error.code, error.title), body=body, headers=headers)
def render_exception(error, user_locale=None): """Forms a WSGI response based on the current error.""" body = { 'error': { 'code': error.code, 'title': error.title, 'message': unicode( gettextutils.get_localized_message(error.args[0], user_locale)), } } headers = [] if isinstance(error, exception.AuthPluginException): body['error']['identity'] = error.authentication elif isinstance(error, exception.Unauthorized): headers.append(('WWW-Authenticate', 'Keystone uri="%s"' % (CONF.public_endpoint % CONF))) return render_response(status=(error.code, error.title), body=body, headers=headers)