The format() method is the new, preferred syntax for string formatting in Python 3. The old style % operation has been deprecated. As of now, FreeIPA's gettext helpers only support % and not format.
format()
%
format
The improvement is required to fix some bad translation, see https://github.com/freeipa/freeipa/pull/1997
Add format method to ipalib.text (untested example):
ipalib.text
class Gettext: ... def format(self, *args, **kwargs): return unicode(self).format(*args, **kwargs) class NGettext: ... def format(self, **kwargs): count = kwargs['count'] return self(count).format(**kwargs) class ConcatenatedLazyText: ... def format(self, *args, **kwargs): return unicode(self).format(*args, **kwargs)
Add tests for format to ipatests.test_ipalib.test_text. You can just copy and modify the test_mod tests for all three classes.
ipatests.test_ipalib.test_text
test_mod
master:
Metadata Update from @cheimes: - Issue close_status updated to: fixed - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.