From: Jelte Jansen Date: Sun, 30 Sep 2012 10:48:40 +0000 (+0200) Subject: [2254] Add more docstring to _get_list_items X-Git-Tag: trac2402_base~83^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26cd9b7104c48ecce553cab9c8e7de6f57c8e88f;p=thirdparty%2Fkea.git [2254] Add more docstring to _get_list_items --- diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py index 654bdd7d8b..7e85852375 100644 --- a/src/lib/python/isc/config/config_data.py +++ b/src/lib/python/isc/config/config_data.py @@ -799,7 +799,36 @@ class MultiConfigData: indices and named_set names to the completion list. If the given item_name is for a list or named_set, it'll return a list of those (appended to item_name), otherwise - the list will only contain the item_name itself.""" + the list will only contain the item_name itself. + + If the item is a named set, and it's contents are maps + or named_sets as well, a / is appended to the result + strings. + + Parameters: + item_name (string): the (full) identifier for the list or + named_set to enumerate. + + Returns a list of strings with item names + + Examples: + _get_list_items("Module/some_item") + where item is not a list of a named_set, or where + said list or named set is empty, returns + ["Module/some_item"] + _get_list_items("Module/named_set") + where the named_set contains items with names 'a' + and 'b', returns + [ "Module/named_set/a", "Module/named_set/b" ] + _get_list_items("Module/named_set_of_maps") + where the named_set contains items with names 'a' + and 'b', and those items are maps themselves + (or other named_sets), returns + [ "Module/named_set/a/", "Module/named_set/b/" ] + _get_list_items("Module/list") + where the list contains 2 elements, returns + [ "Module/list[0]", "Module/list[1]" ] + """ spec_part = self.find_spec_part(item_name) if spec_part_is_named_set(spec_part): values, status = self.get_value(item_name)