BaseException.message has been deprecated as of Python 2.6

Bug #898510 reported by Zhongyue Luo on 2011-12-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Low
Zhongyue Luo

Bug Description

horizon/horizon/horizon/forms.py:215: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  messages.error(request, _('%s') % e.message)

horizon/horizon/dashboards/nova/networks/forms.py:47: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  {"network": network_name, "msg": e.message})

horizon/dashboards/nova/networks/forms.py:173: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  "msg": e.message})

horizon/horizon/dashboards/nova/networks/views.py:105: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  _('Unable to get network details: %s') % e.message)

I'll write a patch something like:

if hasattr(e, 'message'):
    return e.message
else:
    return str(e)

Zhongyue Luo (zyluo) on 2011-12-01
Changed in horizon:
assignee: nobody → ZhongYue Luo (lzyeval)
Zhongyue Luo (zyluo) on 2011-12-01
description: updated
Zhongyue Luo (zyluo) wrote :

found/fixed all the deprecated code in the horizon package and ran test.

still may be more in test code.

Zhongyue Luo (zyluo) wrote :

Apparently there are much more of these deprecated code in the package. Still working on this.

Changed in horizon:
status: New → Confirmed
Zhongyue Luo (zyluo) on 2011-12-10
Changed in horizon:
status: Confirmed → In Progress
Devin Carlen (devcamcar) on 2011-12-17
Changed in horizon:
importance: Undecided → Low
milestone: none → essex-3

Reviewed: https://review.openstack.org/2355
Committed: http://github.com/openstack/horizon/commit/5aed18784beb2001668f724bd3b84fca67400007
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit 5aed18784beb2001668f724bd3b84fca67400007
Author: ZhongYue Luo <email address hidden>
Date: Wed Dec 14 21:08:04 2011 +0900

    Fixes deprecated attribute access.

    Fixes bug 898510

    I did a hasattr check whenever the code tries to access
    the message attribute of a BaseException.

    Since openstackx, glance, and quantum implements their exceptions
    with a message attribute, I thought keeping the message attribute access
    was logical.

    Change-Id: Iabe986359077d11bb4bdae15f9e7d6db2aecdbb0

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-01-25
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in horizon:
milestone: essex-3 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers