summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-01-23 22:53:01 +0100
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-01-23 22:53:01 +0100
commiteecc35863f17d131a5e4d1385ab9e9cc7560d5ca (patch)
treeee1b08823aa7d4c73bf40351c91b39a988e6c6e1
parente58689c2dd7765ece5d6b6cfe095d4fff0e0e916 (diff)
Fixed bug when user have not-uin like numbers in import list.
-rwxr-xr-xsunshine/lqsoft/pygadu/models.py18
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()