use force_text instead of force_unicode

Bug #1345642 reported by Felipe Reyes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Felipe Reyes

Bug Description

Horizon's code base uses force_unicode()[0] function to ensure the an object is correctly transformed to unicode text, this function is part of Django. This function is deprecated.

Since Django 1.5 there are new functions to string handling[1] and force_unicode() since then is an alias of force_text(), but only available when Django is running in a Python 2.x interpreter, Django doesn't provide the alias when is running on Python 3.x[2]

Horizon should start using force_text() to be able to run on Python 3

[0] https://docs.djangoproject.com/en/1.4/ref/unicode/#conversion-functions
[1] https://docs.djangoproject.com/en/1.5/topics/python3/#string-handling
[2] https://github.com/django/django/blob/1.5/django/utils/encoding.py#L171

Felipe Reyes (freyes)
Changed in horizon:
assignee: nobody → Felipe Reyes (freyes)
Changed in horizon:
status: New → In Progress
Revision history for this message
Julie Pichon (jpichon) wrote :
Changed in horizon:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/107708
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=af49cf1f156e68dcd8d34a3de59c40ee5bd12b66
Submitter: Jenkins
Branch: master

commit af49cf1f156e68dcd8d34a3de59c40ee5bd12b66
Author: Felipe Reyes <email address hidden>
Date: Wed Jul 16 17:50:03 2014 +0200

    Replace force_unicode with force_text

    Django changed the name to force_unicode and it's only available in
    python2 as an alias of force_text. The new name is available since
    Django 1.4.2

    Closes-Bug: #1345642
    Change-Id: Ida8c545ceec7c31999f2497d540a0dc5a653d286

Changed in horizon:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in horizon:
milestone: none → juno-3
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.