def testBackslashesKeys(self): conf.supybot.reply.whenAddressedBy.strings.get(':foo').set('=/*') filename = conf.supybot.directories.conf.dirize('backslashes1.conf') registry.close(conf.supybot, filename) registry.open_registry(filename) value = conf.supybot.reply.whenAddressedBy.strings.get(':foo')() self.assertEqual(value, set(['=/*']))
def testSpacesValues(self): with conf.supybot.networks.test.password.context(' foo '): self.assertEqual(conf.supybot.networks.test.password(), ' foo ') filename = conf.supybot.directories.conf.dirize('spaces.conf') registry.close(conf.supybot, filename) registry.open_registry(filename) self.assertEqual(conf.supybot.networks.test.password(), ' foo ')
def closeRegistry(): # We only print if world.dying so we don't see these messages during # upkeep. logger = log.debug if world.dying: logger = log.info logger('Writing registry file to %s', registryFilename) registry.close(conf.supybot, registryFilename) logger('Finished writing registry file.')
def export(self, irc, msg, args, filename): """<filename> Exports the public variables of your configuration to <filename>. If you want to show someone your configuration file, but you don't want that person to be able to see things like passwords, etc., this command will export a "sanitized" configuration file suitable for showing publicly. """ registry.close(conf.supybot, filename, private=False) irc.replySuccess()
def export(self, irc, msg, args, filename): """<filename> Exports the public variables of your configuration to <filename>. If you want to show someone your configuration file, but you don't want that person to be able to see things like passwords, etc., this command will export a "sanitized" configuration file suitable for showing publicly. """ if not conf.supybot.commands.allowShell(): # Disallow writing arbitrary files irc.error('This command is not available, because ' 'supybot.commands.allowShell is False.', Raise=True) registry.close(conf.supybot, filename, private=False) irc.replySuccess()
conf.registerPlugin('Admin', True) conf.registerPlugin('Channel', True) conf.registerPlugin('Config', True) conf.registerPlugin('Misc', True) conf.registerPlugin('User', True) ### # Write the registry ### # We're going to need to do a darcs predist thing here. #conf.supybot.debug.generated.setValue('...') if not filename: filename = '%s.conf' % nick registry.close(conf.supybot, filename) # Done! output("""All done! Your new bot configuration is %s. If you're running a *nix based OS, you can probably start your bot with the command line "supybot %s". If you're not running a *nix or similar machine, you'll just have to start it like you start all your other Python scripts.""" % \ (filename, filename)) if __name__ == '__main__': try: main() except KeyboardInterrupt: # We may still be using bold text when exiting during a prompt if questions.useBold:
def testBackslashesValues(self): conf.supybot.reply.whenAddressedBy.chars.set('\\') filename = conf.supybot.directories.conf.dirize('backslashes2.conf') registry.close(conf.supybot, filename) registry.open_registry(filename) self.assertEqual(conf.supybot.reply.whenAddressedBy.chars(), '\\')
def _flushUserData(): userdataFilename = os.path.join(conf.supybot.directories.conf(), "userdata.conf") registry.close(conf.users, userdataFilename)
def _flushUserData(): userdataFilename = os.path.join(conf.supybot.directories.conf(), 'userdata.conf') registry.close(conf.users, userdataFilename)
conf.registerPlugin('Admin', True) conf.registerPlugin('Channel', True) conf.registerPlugin('Config', True) conf.registerPlugin('Misc', True) conf.registerPlugin('User', True) ### # Write the registry ### # We're going to need to do a darcs predist thing here. #conf.supybot.debug.generated.setValue('...') if not filename: filename = '%s.conf' % nick registry.close(conf.supybot, filename) # Done! output("""All done! Your new bot configuration is %s. If you're running a *nix based OS, you can probably start your bot with the command line "supybot %s". If you're not running a *nix or similar machine, you'll just have to start it like you start all your other Python scripts.""" % \ (filename, filename)) if __name__ == '__main__': try: main() except KeyboardInterrupt: # We may still be using bold text when exiting during a prompt if questions.useBold: import supybot.ansi as ansi
def testBackslashes(self): conf.supybot.reply.whenAddressedBy.chars.set('\\') filename = conf.supybot.directories.conf.dirize('backslashes.conf') registry.close(conf.supybot, filename) registry.open_registry(filename) self.assertEqual(conf.supybot.reply.whenAddressedBy.chars(), '\\')