BaseException.message has been deprecated as of Python 2.6

Bug #898510 reported by Zhongyue Luo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
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)
Changed in horizon:
assignee: nobody → ZhongYue Luo (lzyeval)
Zhongyue Luo (zyluo)
description: updated
Revision history for this message
Zhongyue Luo (zyluo) wrote :

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

still may be more in test code.

Revision history for this message
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)
Changed in horizon:
status: Confirmed → In Progress
Revision history for this message
Zhongyue Luo (zyluo) wrote :
Devin Carlen (devcamcar)
Changed in horizon:
importance: Undecided → Low
milestone: none → essex-3
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to horizon (master)

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)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: essex-3 → 2012.1
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.