From eecc35863f17d131a5e4d1385ab9e9cc7560d5ca Mon Sep 17 00:00:00 2001 From: Krzysztof Klinikowski Date: Sat, 23 Jan 2010 22:53:01 +0100 Subject: Fixed bug when user have not-uin like numbers in import list. --- sunshine/lqsoft/pygadu/models.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'sunshine') 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() -- cgit v1.2.3