def migratePasswordsToKeychain(self): if NSApp.delegate().applicationName == 'SIP2SIP': return account_manager = AccountManager() configuration_manager = ConfigurationManager() bonjour_account = BonjourAccount() for account in (account for account in account_manager.iter_accounts() if account is not bonjour_account): try: stored_auth_password = configuration_manager.get(account.__key__ + ['auth', 'password']) except ObjectNotFoundError: stored_auth_password = None try: stored_ldap_password = configuration_manager.get(account.__key__ + ['ldap', 'password']) except ObjectNotFoundError: stored_ldap_password = None try: stored_web_password = configuration_manager.get(account.__key__ + ['server', 'web_password']) except ObjectNotFoundError: stored_web_password = None if (stored_auth_password, stored_ldap_password, stored_web_password) != ('keychain', 'keychain', 'keychain'): Account.auth.password.dirty[account.auth] = True Account.ldap.password.dirty[account.ldap] = True Account.server.web_password.dirty[account.server] = True account.save()
def migratePasswordsToKeychain(self): account_manager = AccountManager() configuration_manager = ConfigurationManager() bonjour_account = BonjourAccount() for account in (account for account in account_manager.iter_accounts() if account is not bonjour_account): try: stored_auth_password = configuration_manager.get( account.__key__ + ['auth', 'password']) except ObjectNotFoundError: stored_auth_password = None try: stored_ldap_password = configuration_manager.get( account.__key__ + ['ldap', 'password']) except ObjectNotFoundError: stored_ldap_password = None try: stored_web_password = configuration_manager.get( account.__key__ + ['server', 'web_password']) except ObjectNotFoundError: stored_web_password = None if (stored_auth_password, stored_ldap_password, stored_web_password) != ('keychain', 'keychain', 'keychain'): Account.auth.password.dirty[account.auth] = True Account.ldap.password.dirty[account.ldap] = True Account.server.web_password.dirty[account.server] = True account.save()
def cleanupIcons(self): save = False configuration_manager = ConfigurationManager() try: contacts = configuration_manager.get(['Addressbook', 'Contacts']) except Exception: return for data in contacts.itervalues(): if 'icon' in data: del data['icon'] save = True if save: configuration_manager.save()
def cleanupIcons(self): save = False configuration_manager = ConfigurationManager() try: contacts = configuration_manager.get(['Addressbook', 'Contacts']) except Exception: return for data in contacts.values(): if 'icon' in data: del data['icon'] save = True if save: configuration_manager.save()
def __new__(cls, id=None): with VirtualGroupsManager.load.lock: if not VirtualGroupsManager.load.called: raise RuntimeError("cannot instantiate %s before calling VirtualGroupsManager.load" % cls.__name__) if id is None: id = unique_id() elif not isinstance(id, basestring): raise TypeError("id needs to be a string or unicode object") instance = SettingsState.__new__(cls) instance.__id__ = id instance.__state__ = 'new' configuration = ConfigurationManager() try: data = configuration.get(instance.__key__) except ObjectNotFoundError: pass else: instance.__setstate__(data) instance.__state__ = 'loaded' return instance
def __new__(cls, id=None): # with VirtualGroupsManager.load.lock: # if not VirtualGroupsManager.load.called: # raise RuntimeError("cannot instantiate %s before calling VirtualGroupsManager.load" % cls.__name__) if id is None: id = unique_id() elif not isinstance(id, str): raise TypeError("id needs to be a string or unicode object") instance = SettingsState.__new__(cls) instance.__id__ = id instance.__state__ = 'new' configuration = ConfigurationManager() try: data = configuration.get(instance.__key__) except ObjectNotFoundError: pass else: instance.__setstate__(data) instance.__state__ = 'loaded' return instance