Title: locale.format_string fails on mapping keys
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.6
Status: closed Resolution: duplicate
Dependencies: Superseder: locale.format_string fails on escaped percentage
View: 6656
Assigned To: eric.smith Nosy List: eric.smith, mtschopp, r.david.murray
Priority: normal Keywords: easy

Created on 2010-03-09 10:04 by mtschopp, last changed 2010-03-09 14:45 by r.david.murray. This issue is now closed.

Messages (3)
msg100709 - (view) Author: Marcel Tschopp (mtschopp) Date: 2010-03-09 10:04
locale.format_string doesn't return same result as a normal "string" % format directive, but raises a TypeError.

>>> locale.format_string('%(key)s', {'key': 'Test'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/", line 225, in format_string
    val[key] = format(, val[key], grouping)
  File "/usr/local/lib/python2.6/", line 182, in format
    formatted = percent % value
TypeError: format requires a mapping
msg100715 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2010-03-09 11:55
There's definitely some weirdness going on with handling mapping keys. I'll look at it.
msg100726 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-03-09 14:45
See issue 6656.  This bug isn't a quite a duplicate of that bug, but I did discover (and fix) the bug this one reports in the process of creating a patch for that one, so I'm closing this one as a duplicate anyway.
Date User Action Args
2010-03-09 14:45:32r.david.murraysetstatus: open -> closed

superseder: locale.format_string fails on escaped percentage

nosy: + r.david.murray
messages: + msg100726
resolution: duplicate
stage: needs patch -> resolved
2010-03-09 11:55:25eric.smithsetpriority: normal

assignee: eric.smith

keywords: + easy
nosy: + eric.smith
messages: + msg100715
stage: needs patch
2010-03-09 10:04:53mtschoppcreate