auth_token body errors are not returned as bytes for py34

Bug #1372484 reported by Chmouel Boudjnah on 2014-09-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
keystonemiddleware
Medium
Chmouel Boudjnah

Bug Description

[Caveat: I am not a py34 expert so I may be just wrong here ;) ]

I am trying to use auth_token middleware for a personal project, this project is a py34 only. So far at runtime things seems to work and auth_token works under py34 byt when trying to integrate this with webtest for my unittesting I am getting this error ;

AssertionError: Iterator <list_iterator object at 0x7f8605664128> returned a non-<class 'bytes'> object: 'Authentication required'

this come from webtest which explictely check if the error message come as bytes :

https://github.com/Pylons/webtest/blob/master/webtest/lint.py#L298-L300

it seems that the obvious fix is something like this (which should work on py2 as well) :

http://paste.openstack.org/raw/fMNhM0Sd9hw4q3uuN5gq/

Which seems right, I think but I am not totally sure, let me know what do you think before I submit it.

description: updated

Fix proposed to branch: master
Review: https://review.openstack.org/123451

Changed in keystonemiddleware:
assignee: nobody → Chmouel Boudjnah (chmouel)
status: New → In Progress
Dolph Mathews (dolph) on 2014-09-26
Changed in keystonemiddleware:
importance: Undecided → Medium

Reviewed: https://review.openstack.org/123451
Committed: https://git.openstack.org/cgit/openstack/keystonemiddleware/commit/?id=6266ed437d454a95bbd002234f94e646e45b29a7
Submitter: Jenkins
Branch: master

commit 6266ed437d454a95bbd002234f94e646e45b29a7
Author: Chmouel Boudjnah <email address hidden>
Date: Tue Sep 23 16:33:51 2014 +0200

    Encode middleware error message as bytes

    On py3 the middleware message needs to be passed as bytes instead of
    string. Since on py2 str.encode() doesn't do anything it doesn't change
    the behavior there.

    Change-Id: Ie593e8659be736aa4d85ca2a47ae2a30db446f84
    Closes-Bug: 1372484

Changed in keystonemiddleware:
status: In Progress → Fix Committed
Changed in keystonemiddleware:
milestone: none → 1.3.0
Changed in keystonemiddleware:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers