From 322923c9577ec0cfffaec65db5c51392d802574d Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 2 Nov 2019 18:47:45 +0100 Subject: [PATCH] Config: make 'config list' exclude pseudo-children of network-specific variables. --- plugins/Config/plugin.py | 9 +++++++-- plugins/Config/test.py | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/Config/plugin.py b/plugins/Config/plugin.py index 2fdaaad5c..d2933f0c5 100644 --- a/plugins/Config/plugin.py +++ b/plugins/Config/plugin.py @@ -151,8 +151,13 @@ class Config(callbacks.Plugin): def _list(self, irc, group): L = [] for (vname, v) in group._children.items(): - if hasattr(group, '_channelValue') and group._channelValue and \ - irc.isChannel(vname) and not v._children: + if getattr(group, '_networkValue', False) and \ + vname.startswith(':'): + # Skip pseudo-children that are network names + continue + if getattr(group, '_channelValue', False) and \ + irc.isChannel(vname): + # Skip pseudo-children that are channel names continue if hasattr(v, '_channelValue') and v._channelValue: vname = '#' + vname diff --git a/plugins/Config/test.py b/plugins/Config/test.py index e79cd506c..64cd66991 100644 --- a/plugins/Config/test.py +++ b/plugins/Config/test.py @@ -56,6 +56,14 @@ class ConfigTestCase(ChannelPluginTestCase): self.assertNotError('config list supybot.replies') self.assertRegexp('config list supybot', r'@plugins.*@replies.*@reply') + def testListExcludes(self): + """Checks that 'config list' excludes pseudo-children of + network-specific and channel-specific variables.""" + self.assertNotError( + 'config channel #zpojfejf supybot.replies.error foo') + self.assertRegexp('config list supybot.replies.error', + "There don't seem to be any values") + def testHelp(self): self.assertError('config help alsdkfj') self.assertError('config help supybot.alsdkfj')