From 4c20f74d904721465e40a0d7231350bfd71e7a5a Mon Sep 17 00:00:00 2001 From: Ricky Zhou Date: Jun 26 2008 23:30:02 +0000 Subject: Move fas username/password to supybot configs. --- diff --git a/config.py b/config.py index d7fde0f..66c67f8 100644 --- a/config.py +++ b/config.py @@ -43,6 +43,11 @@ Fedora = conf.registerPlugin('Fedora') # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(Fedora, 'someConfigVariableName', # registry.Boolean(False, """Help for someConfigVariableName.""")) +conf.registerGroup(Fedora, 'fas') +conf.registerGlobalValue(Fedora.fas, 'username', + registry.String('', """Username for the Fedora Account System""", private=True)) +conf.registerGlobalValue(Fedora.fas, 'password', + registry.String('', """Password for the Fedora Account System""", private=True)) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/plugin.py b/plugin.py index cb4aa6f..7e15dbc 100644 --- a/plugin.py +++ b/plugin.py @@ -79,35 +79,39 @@ class Fedora(callbacks.Plugin): This should describe *how* to use this plugin.""" threaded = True - # Our owners list - owners = None + def __init__(self, irc): + super(Fedora, self).__init__(irc) - # Timestamp of our owners data - owners_timestamp = None + # Our owners list + self.owners = None - # Cache time of owners list, in seconds - owners_cache = 259200 + # Timestamp of our owners data + self.owners_timestamp = None - # /group/dump/ - groupdump = None + # Cache time of owners list, in seconds + self.owners_cache = 259200 - # Timestamp of /group/dump/ data - groupdump_timestamp = None + # /group/dump/ + self.groupdump = None - # Cache time of groupdump, in seconds - groupdump_cache = 1800 + # Timestamp of /group/dump/ data + self.groupdump_timestamp = None - # To get the information, we need a username and password to FAS. - # DO NOT COMMIT YOUR USERNAME AND PASSWORD TO THE PUBLIC REPOSITORY! - username = '' - password = '' + # Cache time of groupdump, in seconds + self.groupdump_cache = 1800 - # URLs - url = {} - url["groupdump"] = 'https://admin.fedoraproject.org/accounts/group/dump/' - url["owners"] = "https://admin.fedoraproject.org/pkgdb/acls/bugzilla?tg_format=plain" + # To get the information, we need a username and password to FAS. + # DO NOT COMMIT YOUR USERNAME AND PASSWORD TO THE PUBLIC REPOSITORY! + self.username = self.registryValue('fas.username') + self.password = self.registryValue('fas.password') + + # URLs + self.url = {} + self.url["groupdump"] = 'https://admin.fedoraproject.org/accounts/group/dump/' + self.url["owners"] = "https://admin.fedoraproject.org/pkgdb/acls/bugzilla?tg_format=plain" + + self.fasclient = AccountSystem('https://admin.fedoraproject.org/accounts/', self.username, self.password) - fasclient = AccountSystem('https://admin.fedoraproject.org/accounts/', username, password) def _getowners(self): """