Can't delete keys from config
codl opened this issue · comments
codl commented
Seems like deleted config keys and values still get written to the config file
$ cat ananas.cfg
[test]
class = test.TestBot
domain = chitter.xyz
client_id = xxxxxxxxxxxx
client_secret = yyyyyyyyyyyy
access_token = zzzzzzzzzzzz
$ cat test.py
import ananas
class TestBot(ananas.PineappleBot):
def start(self):
self.config["secret"] = "my brain IBM"
self.config.save()
del self.config["secret"]
self.config.save()
$ ananas ananas.cfg
range(0, 60, 2)
range(0, 60, 2)
range(0, 60, 1)
range(0, 60, 1)
[2022-04-22 10:25:16] test.config: Loading configuration from ananas.cfg
[2022-04-22 10:25:16] test: Starting TestBot test
[2022-04-22 10:25:16] test.config: Saving configuration to ananas.cfg...
[2022-04-22 10:25:16] test.config: Done.
[2022-04-22 10:25:16] test.config: Saving configuration to ananas.cfg...
[2022-04-22 10:25:16] test.config: Done.
[2022-04-22 10:25:16] test: Startup complete.
^C[2022-04-22 10:25:31] test: Stopping TestBot test
[2022-04-22 10:25:31] test.config: Saving configuration to ananas.cfg...
[2022-04-22 10:25:31] test.config: Done.
Shutdown complete
$ cat ananas.cfg
[test]
class = test.TestBot
domain = chitter.xyz
client_id = xxxxxxxxxxxx
client_secret = yyyyyyyyyyyy
access_token = zzzzzzzzzzzz
secret = my brain IBM