Use of _ function without importing it

Bug #885529 reported by Patrick Hetu on 2011-11-03
18
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Glance
Low
Mike Lundy
Diablo
Undecided
Unassigned

Bug Description

root@os:~# dpkg -l | grep glance
ii glance 2011.3-0ubuntu4 OpenStack Image Registry and Delivery Service - Daemons
ii python-glance 2011.3-0ubuntu4 OpenStack Image Registry and Delivery Service - Python library

/usr/lib/python2.7/dist-packages/glance/common/exception.py use _() for translation but the function is not imported.
So when horizon try to call it, failed.

Traceback:
File "/usr/lib/pymodules/python2.7/django/core/handlers/base.py" in get_response
  101. request.path_info)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py" in resolve
  252. sub_match = pattern.resolve(new_path)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py" in resolve
  252. sub_match = pattern.resolve(new_path)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py" in resolve
  158. return ResolverMatch(self.callback, args, kwargs, self.name)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py" in _get_callback
  164. self._callback = get_callable(self._callback_str)
File "/usr/lib/pymodules/python2.7/django/utils/functional.py" in wrapper
  124. result = func(*args)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py" in get_callable
  91. lookup_view = getattr(import_module(mod_name), func_name)
File "/usr/lib/pymodules/python2.7/django/utils/importlib.py" in import_module
  35. __import__(name)
File "/root/os_dashboard/django_openstack/syspanel/views/images.py" in <module>
  30. from glance.common import exception as glance_exception
File "/usr/lib/python2.7/dist-packages/glance/common/exception.py" in <module>
  57. class UnknownScheme(Error):
File "/usr/lib/python2.7/dist-packages/glance/common/exception.py" in UnknownScheme
  59. msg = _("Unknown scheme '%s' found in URI")

Exception Type: NameError at /syspanel/images/
Exception Value: name '_' is not defined

Jay Pipes (jaypipes) on 2011-11-03
Changed in glance:
status: New → In Progress
importance: Undecided → Low
assignee: nobody → Jay Pipes (jaypipes)
milestone: none → essex-1
Jay Pipes (jaypipes) on 2011-11-08
Changed in glance:
assignee: Jay Pipes (jaypipes) → Mike Lundy (novas0x2a)

Reviewed: https://review.openstack.org/1429
Committed: http://github.com/openstack/glance/commit/8f122d954bb35d18f0afb38aa2822cd1741f05f0
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit 8f122d954bb35d18f0afb38aa2822cd1741f05f0
Author: Mike Lundy <email address hidden>
Date: Tue Nov 8 10:57:27 2011 -0800

    load gettext in __init__ to fix '_ is not defined'

    gettext.install needs to be run on every potential entrypoint; this
    resolves bug #885529 (the python standard library includes a noop
    gettext library for this purpose). This is also how nova does it.

    Change-Id: I4ceaa4782461ebf6d27836336f288d79ba15cf2d

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2011-11-17
Changed in glance:
status: Fix Committed → Fix Released

Reviewed: https://review.openstack.org/1782
Committed: http://github.com/openstack/glance/commit/184024d48b68fea809a3d114b9a2a1a7cc261701
Submitter: Jenkins
Branch: stable/diablo

 tag in-stable-diablo
 done

commit 184024d48b68fea809a3d114b9a2a1a7cc261701
Author: Mike Lundy <email address hidden>
Date: Tue Nov 8 10:57:27 2011 -0800

    load gettext in __init__ to fix '_ is not defined'

    gettext.install needs to be run on every potential entrypoint; this
    resolves bug #885529 (the python standard library includes a noop
    gettext library for this purpose). This is also how nova does it.

    (cherry picked from commit 8f122d954bb35d18f0afb38aa2822cd1741f05f0)

    Change-Id: I4ceaa4782461ebf6d27836336f288d79ba15cf2d

Thierry Carrez (ttx) on 2012-04-05
Changed in glance:
milestone: essex-1 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers