From: Philipp Gesang Date: Mon, 5 Nov 2018 08:21:49 +0000 (+0100) Subject: restore simple_cnf/add_single API X-Git-Tag: v1.4~18^2~4 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=55e596ea96068112c4d6603996a388118bd5e599;p=pyi2ncommon restore simple_cnf/add_single API Restore an API that vanished at some point despite there still being users. This is commit fa747d25a7c47a1ceef165c4e1667b9755c9da0d on autotest/i2n. The original commit message in full: In commit 5f6735c41fc769ac9ba6ee62754ab2b7da3d68d2 Author: Christian Herdtweck Date: Wed Apr 5 18:14:02 2017 +0200 Extend SimpleCnf.add_single to SimpleCnf.add this ApI was folded into .add() without providing an overload for downstream consumers. Provide the symbol again as a thin wrapper around .add() and hope for the behavior to remain unaffected. --- diff --git a/src/simple_cnf.py b/src/simple_cnf.py index eea501e..96dc5b2 100644 --- a/src/simple_cnf.py +++ b/src/simple_cnf.py @@ -314,6 +314,16 @@ class SimpleCnf(object): new_var['children'] = children # only add if non-empty self.__cnfvars.append(new_var) + + def add_single(self, varname, data=u'', number=None): + """ + Add a single cnf var to config on top level. + + Compatibility API. + """ + return self.add (varname, data=data, number=number) + + def append_file_generic(self, reader, cnf, replacements=None): """ Append conf var data from file.