diff options
author | Andrew Resch <andrewresch@gmail.com> | 2016-10-16 18:18:47 -0700 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2016-10-26 09:53:32 +0100 |
commit | 8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa (patch) | |
tree | 925d1168e6bc3211787c288b9091cb909dda223b /gen_web_gettext.py | |
parent | 16da4d851e68c93e4c41c1133192b9f6447a6cd5 (diff) | |
download | deluge-8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa.tar.gz deluge-8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa.tar.bz2 deluge-8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa.zip |
[Py2to3] Clean-up the use of keys() on dictionary objects.
To make the code more Python 3 compatible, I've made a few changes to how we handle keys() or iterkeys() calls on dictionaries. All functionality should remain the same.
* Remove the use of .keys() or .iterkeys() when iterating through a dictionary.
* Remove the use of .keys() when checking if key exists in dictionary.
* Replace dict.keys() with list(dict) to obtain a list of dictionary keys. In Python 3 dict.keys() returns a dict_keys object, not a list.
Diffstat (limited to 'gen_web_gettext.py')
-rwxr-xr-x | gen_web_gettext.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gen_web_gettext.py b/gen_web_gettext.py index 519edf7bd..69dd91d8e 100755 --- a/gen_web_gettext.py +++ b/gen_web_gettext.py @@ -89,7 +89,7 @@ def create_gettext_js(js_dir): gettext_file = os.path.join(os.path.dirname(js_dir), 'gettext.js') with open(gettext_file, 'w') as fp: fp.write(gettext_tpl) - for key in sorted(strings.keys()): + for key in sorted(strings): if DEBUG: fp.write('\n// %s\n' % ', '.join(['%s:%s' % x for x in strings[key]])) fp.write('''GetText.add('%(key)s','${escape(_("%(key)s"))}')\n''' % locals()) |