dict.remove doesn't exists, it's del dict[]
This commit is contained in:
parent
e74dbc89d3
commit
4d76e2993b
|
@ -81,8 +81,8 @@ class Contacts:
|
||||||
def change_account_name(self, old_name, new_name):
|
def change_account_name(self, old_name, new_name):
|
||||||
self._contacts[new_name] = self._contacts[old_name]
|
self._contacts[new_name] = self._contacts[old_name]
|
||||||
self._gc_contacts[new_name] = self._gc_contacts[old_name]
|
self._gc_contacts[new_name] = self._gc_contacts[old_name]
|
||||||
self._contacts.remove(old_name)
|
del self._contacts[old_name]
|
||||||
self._gc_contacts.remove(old_name)
|
del self._gc_contacts[old_name]
|
||||||
|
|
||||||
def add_account(self, account):
|
def add_account(self, account):
|
||||||
self._contacts[account] = {}
|
self._contacts[account] = {}
|
||||||
|
@ -92,8 +92,8 @@ class Contacts:
|
||||||
return self._contacts.keys()
|
return self._contacts.keys()
|
||||||
|
|
||||||
def remove_account(self, account):
|
def remove_account(self, account):
|
||||||
self._contacts.remove(account)
|
del self._contacts[account]
|
||||||
self._gc_contacts.remove(account)
|
del self._gc_contacts[account]
|
||||||
|
|
||||||
def create_contact(self, jid='', name='', groups=[], show='', status='',
|
def create_contact(self, jid='', name='', groups=[], show='', status='',
|
||||||
sub='', ask='', resource='', priority=5, keyID='', our_chatstate=None,
|
sub='', ask='', resource='', priority=5, keyID='', our_chatstate=None,
|
||||||
|
@ -133,7 +133,7 @@ class Contacts:
|
||||||
self._contacts[account][contact.jid].remove(contact)
|
self._contacts[account][contact.jid].remove(contact)
|
||||||
# It was the last resource of this contact ?
|
# It was the last resource of this contact ?
|
||||||
if not len(self._contacts[account][contact.jid]):
|
if not len(self._contacts[account][contact.jid]):
|
||||||
self._contacts[account].remove(contact.jid)
|
del self._contacts[account][contact.jid]
|
||||||
|
|
||||||
def remove_jid(self, account, jid):
|
def remove_jid(self, account, jid):
|
||||||
'''Removes all contacts for a given jid'''
|
'''Removes all contacts for a given jid'''
|
||||||
|
@ -256,17 +256,17 @@ class Contacts:
|
||||||
if not self._gc_contacts[account][gc_contact.room_jid].has_key(
|
if not self._gc_contacts[account][gc_contact.room_jid].has_key(
|
||||||
gc_contact.nick):
|
gc_contact.nick):
|
||||||
return
|
return
|
||||||
self._gc_contacts[account][gc_contact.room_jid].remove(gc_contact.nick)
|
del self._gc_contacts[account][gc_contact.room_jid][gc_contact.nick]
|
||||||
# It was the last nick in room ?
|
# It was the last nick in room ?
|
||||||
if not len(self._gc_contacts[account][gc_contact.room_jid]):
|
if not len(self._gc_contacts[account][gc_contact.room_jid]):
|
||||||
self._gc_contacts[account].remove(gc_contact.room_jid)
|
del self._gc_contacts[account][gc_contact.room_jid]
|
||||||
|
|
||||||
def remove_room(self, account, room_jid):
|
def remove_room(self, account, room_jid):
|
||||||
if not self._gc_contacts.has_key(account):
|
if not self._gc_contacts.has_key(account):
|
||||||
return
|
return
|
||||||
if not self._gc_contacts[account].has_key(room_jid):
|
if not self._gc_contacts[account].has_key(room_jid):
|
||||||
return
|
return
|
||||||
self._gc_contacts[account].remove(room_jid)
|
del self._gc_contacts[account][room_jid]
|
||||||
|
|
||||||
def get_gc_contact(self, account, room_jid, nick):
|
def get_gc_contact(self, account, room_jid, nick):
|
||||||
if not self._gc_contacts.has_key(account):
|
if not self._gc_contacts.has_key(account):
|
||||||
|
@ -275,7 +275,7 @@ class Contacts:
|
||||||
return
|
return
|
||||||
if not self._gc_contacts[account][room_jid].has_key(nick):
|
if not self._gc_contacts[account][room_jid].has_key(nick):
|
||||||
return
|
return
|
||||||
self._gc_contacts[account][room_jid].remove(nick)
|
del self._gc_contacts[account][room_jid][nick]
|
||||||
|
|
||||||
def get_gc_list(self, account):
|
def get_gc_list(self, account):
|
||||||
if not self._gc_contacts.has_key(account):
|
if not self._gc_contacts.has_key(account):
|
||||||
|
|
Loading…
Reference in New Issue