summaryrefslogtreecommitdiff
path: root/HACKING.rst
diff options
context:
space:
mode:
authorJames Carey <jecarey@us.ibm.com>2014-10-17 13:14:26 -0700
committerJames Carey <jecarey@us.ibm.com>2014-10-22 18:05:48 +0000
commit6683905b532b6030989064636aa5506d4cbe5b22 (patch)
tree5a2b2e4a23cff1db714915864aea04078fa00dd8 /HACKING.rst
parent502b420941f73f8af3684c816a012839aa8cdd6c (diff)
downloadnova-6683905b532b6030989064636aa5506d4cbe5b22.tar.gz
Remove use of unicode on exceptions
Casting exceptions to unicode using unicode() can interfere with the proper translation of the exception message. This is especially true when lazy translation is enabled, since it causes the exception message to be translated immediately using the default locale. This is the same problem caused by using str on exceptions, which was fixed by https://review.openstack.org/#/c/116054/ In addition to fixing these cases, this patch updates hacking check N325, which checks for the use of str() on exceptions, to also check for the use of unicode(). In order to make it clear which cases that cannot be caught by the hacking check have been inspected, they have been converted to using six.text_type() instead of unicode(). Closes-bug: #1380806 Change-Id: I87bb94fa76458e028beba28d092320057b53f70a
Diffstat (limited to 'HACKING.rst')
-rw-r--r--HACKING.rst2
1 files changed, 1 insertions, 1 deletions
diff --git a/HACKING.rst b/HACKING.rst
index f1a7f1ed1b..0fb08e6670 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -37,7 +37,7 @@ Nova Specific Commandments
- [N322] Method's default argument shouldn't be mutable
- [N323] Ensure that the _() function is explicitly imported to ensure proper translations.
- [N324] Ensure that jsonutils.%(fun)s must be used instead of json.%(fun)s
-- [N325] str() cannot be used on an exception. Remove use or use six.text_type()
+- [N325] str() and unicode() cannot be used on an exception. Remove use or use six.text_type()
- [N326] Translated messages cannot be concatenated. String should be included in translated message.
- [N327] assert_called_once() is not a valid method