From 30ad859fe08b8b78affcf45aa1fe63d86569b163 Mon Sep 17 00:00:00 2001 From: Andreas Fleig Date: Mon, 7 Apr 2014 20:01:11 +0200 Subject: [PATCH] ini_file: replace lambda with named function Fixes #6876 --- library/files/ini_file | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/library/files/ini_file b/library/files/ini_file index dbb015d79d1..29abe510657 100644 --- a/library/files/ini_file +++ b/library/files/ini_file @@ -95,6 +95,7 @@ def do_ini(module, filename, section=None, option=None, value=None, state='prese changed = False cp = ConfigParser.ConfigParser() + cp.optionxform = identity try: f = open(filename) @@ -150,6 +151,19 @@ def do_ini(module, filename, section=None, option=None, value=None, state='prese return changed +# ============================================================== +# identity + +def identity(arg): + """ + This function simply returns its argument. It serves as a + replacement for ConfigParser.optionxform, which by default + changes arguments to lower case. The identity function is a + better choice than str() or unicode(), because it is + encoding-agnostic. + """ + return arg + # ============================================================== # main