Merge lp:~soren/nova/locale-friendly-tests into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Rejected
Rejected by: Soren Hansen
Proposed branch: lp:~soren/nova/locale-friendly-tests
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 12 lines (+1/-1)
1 file modified
nova/twistd.py (+1/-1)
To merge this branch: bzr merge lp:~soren/nova/locale-friendly-tests
Reviewer Review Type Date Requested Status
Cory Wright (community) Needs Information
Review via email: mp+52990@code.launchpad.net

Commit message

Call FLAGS.GetHelp() instead of str(FLAGS). Otherwise, non-ascii characters (like in translated strings) will cause tests to fail.

To post a comment you must log in.
Revision history for this message
Cory Wright (corywright) wrote :

In the gflags.FlagValues class, which is what nova.flags.FlagValues inherits from, the FlagValues.__str__() method already calls GetHelp():

  def __str__(self):
    """Generates a help string for all known flags."""
    return self.GetHelp()

Am I missing something?

review: Needs Information
Revision history for this message
Soren Hansen (soren) wrote :

2011/3/11 Cory Wright <email address hidden>:
> Review: Needs Information
> In the gflags.FlagValues class, which is what nova.flags.FlagValues inherits from, the FlagValues.__str__() method already calls GetHelp():
>
>  def __str__(self):
>    """Generates a help string for all known flags."""
>    return self.GetHelp()
>
> Am I missing something?

You seem to be correct. It seems that gflags cheats by returning a
unicode object in its __str__. Our wrapper then tries to str()ifiy it,
which fails if there are non-ascii values in the unicode string. Gah.

--
Soren Hansen        | http://linux2go.dk/
Ubuntu Developer    | http://www.ubuntu.com/
OpenStack Developer | http://www.openstack.org/

Revision history for this message
Soren Hansen (soren) wrote :

Lovely. It turns out that this will only mask it in out unit tests.
Running bin/nova-objectstore --help actually fails, because gflags
doesn't support unicode characters at all.

I've filed http://code.google.com/p/python-gflags/issues/detail?id=6
about the issue.

--
Soren Hansen        | http://linux2go.dk/
Ubuntu Developer    | http://www.ubuntu.com/
OpenStack Developer | http://www.openstack.org/

Unmerged revisions

784. By Soren Hansen

Call FLAGS.GetHelp() instead of str(FLAGS). Otherwise, non-ascii characters (like in translated strings) will cause tests to fail.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/twistd.py'
2--- nova/twistd.py 2011-02-21 21:46:41 +0000
3+++ nova/twistd.py 2011-03-11 10:10:36 +0000
4@@ -139,7 +139,7 @@
5 handler(self[param])
6
7 def __str__(self):
8- return str(FLAGS)
9+ return FLAGS.GetHelp()
10
11 def parseOptions(self, options=None):
12 if options is None: