From f0c67193a914f9bdd9dc2806bce81c98d7aed5bb Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 10 Jul 2014 22:32:41 +0200 Subject: [PATCH] Implement ConfigManager.items(). If this isn't implemented, _interpolate_some will fail when doing a double-interpolation. --- qutebrowser/config/config.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 562bebae1..84bfac3e7 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -224,6 +224,23 @@ class ConfigManager(QObject): e.option = k raise + def items(self, sectname, raw=True): + """Get a list of (optname, value) tuples for a section. + + Implemented for configparser interpolation compatbility. + + Args: + sectname: The name of the section to get. + raw: Whether to get raw values. Note this parameter only exists + for ConfigParser compatibility and raw=False is not supported. + """ + items = [] + if not raw: + raise ValueError("items() with raw=True is not implemented!") + for optname, option in self.sections[sectname].items(): + items.append((optname, option.value)) + return items + def has_option(self, sectname, optname): """Check if option exists in section.