diff options
author | Krzysztof Klinikowski <kkszysiu@gmail.com> | 2010-01-23 22:53:01 +0100 |
---|---|---|
committer | Krzysztof Klinikowski <kkszysiu@gmail.com> | 2010-01-23 22:53:01 +0100 |
commit | eecc35863f17d131a5e4d1385ab9e9cc7560d5ca (patch) | |
tree | ee1b08823aa7d4c73bf40351c91b39a988e6c6e1 | |
parent | e58689c2dd7765ece5d6b6cfe095d4fff0e0e916 (diff) |
Fixed bug when user have not-uin like numbers in import list.
-rwxr-xr-x | sunshine/lqsoft/pygadu/models.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sunshine/lqsoft/pygadu/models.py b/sunshine/lqsoft/pygadu/models.py index 1095b31..c309a70 100755 --- a/sunshine/lqsoft/pygadu/models.py +++ b/sunshine/lqsoft/pygadu/models.py @@ -117,9 +117,21 @@ class GaduProfile(object): self.addGroup( GaduContactGroup.from_xml(elem) ) for elem in book.find('Contacts').getchildren(): - contact = GaduContact.from_xml(elem) - self.addContact( contact ) - self.__connection.addNewContact(contact) + is_uin_ok = 1 + try: + check_uin = elem.find("GGNumber") + int(check_uin.text) + if check_uin.text == '': + is_uin_ok = 0 + except: + is_uin_ok = 0 + + if is_uin_ok == 1: + contact = GaduContact.from_xml(elem) + self.addContact( contact ) + self.__connection.addNewContact(contact) + else: + print 'Failed to import contact. Invalid uin: %s.' % check_uin.text callback() |