Commit Graph

12 Commits

Author SHA1 Message Date
Matt Riedemann f002437d98 Remove i18n.enable_lazy() call from glance.cmd
Lazy translation of messages is not used in OpenStack. This
causes problems for commands which use translatable messages.
The lazy translation effort was abandoned several years ago.

Change-Id: Iab3d772d7ad9958b54f095b45387a6eb463ce5e6
Related-Bug: #1801761
2018-12-05 16:37:41 -05:00
Mehdi Abaakouk 3988a9956e remove useless EVENTLET_NO_GREENDNS
Since eventlet 0.17, ipv6 is support for dns and getaddrinfo.

Glance depends on 0.18.2, so the workaround is no more needed.

a6ce444265

Related-bug: #1655727
Change-Id: Ic2bdc9a780ee98df87a7cdd5413a9db42e5e7131
2017-01-17 10:28:57 +01:00
kairat_kushaev c27c25f779 Import i18n functions directly
Import i18n functions from module directly and do not use
global module variables like _ = i18n._. It makes code shorter
and cleaner. It also to detect cases when these functions are not
used in module.

Change-Id: Iaa593ac1f2dd15cbcad049bef6ba68f1cfa610da
2015-12-07 18:20:43 +03:00
Louis Taylor 41d45dfb1c Move from oslo.utils to oslo_utils
oslo_utils has been moved out of the oslo namespace.

bp drop-namespace-packages

Change-Id: Ie818e72b31efd2a6ab182444967bdfaca9366f4a
2015-01-09 20:01:42 +00:00
Edward Hope-Morley bd2a8422d3 Fix getaddrinfo if dnspython is installed
If dnspython is present in the environment then eventlet
monkeypatches socket.getaddrinfo() with an implementation
which doesn't work for IPv6.

This patch has also been applied to other Openstack
projects such as nova (f2e49ad3) and keystone (3afd9791)
in order to work around the same problem and is
intended to be used in the same way.

Co-authored-by: Hui Xiang <hui.xiang@canonical.com>
Closes-Bug: 1331885
Change-Id: I795e004eac3f032217ff9cb0047f1976306fbb71
2014-12-05 09:29:16 +00:00
James Carey 3f2a56ae65 Move from using _ builtin to using glance.i18n _
The builtin _ should not longer be used.  Instead _
should be explicitly assigned from glance.i18n.

This patch does the following:
  (1) adds these explict assignments to any
      glance file that was missing them,
  (2) removes the defintion of _ as a builtin from
      tox.ini so that a pep8 failure will occur
      if _ is not defined,
  (3) removes calls to install().

This removes the last direct use of gettextutils by glance.
The indirect uses, via openstack/common, will be removed
in the next sync with oslo.

Change-Id: Ie54e8a67e747e022cc01022dfad35d89686bdfc4
2014-11-21 18:51:19 +00:00
Flavio Percoco c300e1c259 Switch over oslo.i18n
oslo.i18n has recently been released. This patch switches glance over
oslo.i18n. As per oslo.i18n's instructions, a new i18n module has been
added under glance. This module defines the translation globals and
imports the necessary functions from oslo.i18n.

The patch doesn't change the way Glance does translation, this means
that a `_` function is still being injected to the builtins.

Note that the gettextutils module is still a required module from
oslo-inc because there are oslo-inc modules that depend on the old
gettextutils module.

Change-Id: Ieb83681e35f72a5a4ecd849bb76af7f78d9fdcb0
2014-07-08 15:28:44 +02:00
Fei Long Wang f70b72b78b Add support for API message localization
Add support for doing language resolution for a request,
based on the Accept-Language HTTP header. For example,
an HTTP client can receive API messages in Chinese even
if the locale language of the server is English.

The underscore (_) method is initialized so that it returns
openstack.common.gettextutils.Message objects. The locale
of these Message objects is set when exceptions with which
they are associated are raised in the context of an HTTP
request.

docImpact
Partially implements bp i18n-messages

Signed-off-by: Fei Long Wang <flwang@cn.ibm.com>
Signed-off-by: John Warren <jswarren@us.ibm.com>

Change-Id: I352cda57fe119022c59c6c813b5c8053765b2d3c
2014-03-04 14:18:28 +08:00
Noboru arai 8de10b0f34 Remove vim header
No need to set tabstop tons of times, this can be set in your vimrc
file instead.

More disucssion:
http://openstack.10931.n7.nabble.com/Remove-vim-modelines-td21780.html

Change-Id: I3b830a5bb831a63c188109e6fad66ba48884fff3
Partial-Bug: #1229324
2014-01-14 16:03:28 +00:00
Dirk Mueller 518bbf7298 Changed header from LLC to Foundation based on trademark policies
Fixes: Bug 1214176

Change-Id: I4e394c33d810fe7d48066ff7cb6143f7eae25f13
2013-09-10 18:29:53 +02:00
Mark McLoughlin a0209e8757 Add GLANCE_LOCALEDIR env variable
Part of fixing bug #995287

Syncs these two commits from oslo-incubator:

  Support overriding oslo localedir too
  Add a gettextutils.install() helper function

to get a new gettextutils.install() function which allows the default
localedir to be overwritten via an environment variable.

Note that gettextutils.install() must be called before any other glance
modules are imported since some modules attempt to translate strings
at import time (e.g. the help strings for config options in config.py).
This is broken and inefficient, but fixing it involves adding something
like spinx's l_() function and would be very invaisve.

Also, note that calling gettextutils.install() in glance.cmd.__init__
means that no program which uses a different translation domain should
ever import any of the modules under glance.cmd.

Change-Id: I86562b3a65d371673bb21f7179eecc7602bc0775
2013-05-08 09:23:32 +01:00
John Bresnahan 039f3d8a59 Convert scripts to entry points
The executable programs used by Glance have historically been scripts
in the ./bin directory.  This patch converts all of the scripts to
entry_points.  This change makes these programs python modules.  Thus
they can be imported and methods in them can be called just like any
other module.  This will allow the tests to call into these programs
directly instead of having to fork out a process.

The conf.py file in the doc tree was causing a name collision with
the python module cmd.  The glance/glance directory was being added
to sys.path which made glance.cmd import with the name cmd.  This
patch also fixes that problem.

blueprint: refactoring-better-faster-stronger-functional-tests
Change-Id: I67ae14b7403af31a5944befcd2ec27a690e81f15
2013-04-29 14:08:29 -10:00