In theory, adding some hardening against bugs due to some reports on internet tablet...
authorepage <eopage@byu.net>
Fri, 20 Mar 2009 00:37:18 +0000 (00:37 +0000)
committerepage <eopage@byu.net>
Fri, 20 Mar 2009 00:37:18 +0000 (00:37 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@232 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/dc_glade.py
src/gc_backend.py
src/gv_backend.py

index 1b28a61..0eec7a5 100755 (executable)
@@ -245,7 +245,12 @@ class Dialcentral(object):
                assert 0 < numOfAttempts, "That was pointless having 0 or less login attempts"
 
                if not self._deviceIsOnline:
-                       warnings.warn("Attempted to login while device was offline", UserWarning, 2)
+                       warnings.warn("Attempted to login while device was offline")
+                       return False
+               elif self._phoneBackend is None:
+                       warnings.warn(
+                               "Attempted to login before initialization is complete, did an event fire early?"
+                       )
                        return False
 
                loggedIn = False
index 87797ae..8e38722 100644 (file)
@@ -314,9 +314,13 @@ class GCDialer(object):
        def _grab_token(self, data):
                "Pull the magic cookie from the datastream"
                atGroup = self._accessTokenRe.search(data)
+               if atGroup is not None:
+                       raise RuntimeError("Could not extract authentication token from GrandCentral")
                self._accessToken = atGroup.group(1)
 
                anGroup = self._accountNumRe.search(data)
+               if atGroup is not None:
+                       raise RuntimeError("Could not extract account number from GrandCentral")
                self._accountNum = anGroup.group(1)
 
                self._callbackNumbers = {}
index c90e584..a7e5823 100644 (file)
@@ -369,17 +369,19 @@ class GVDialer(object):
                jsonTree = parse_json(flatJson)
                return jsonTree
 
-       def _grab_account_info(self, loginPage = None):
-               if loginPage is None:
+       def _grab_account_info(self, accountNumberPage = None):
+               if accountNumberPage is None:
                        accountNumberPage = self._browser.download(self._accountNumberURL)
-               else:
-                       accountNumberPage = loginPage
+
                tokenGroup = self._tokenRe.search(accountNumberPage)
                if tokenGroup is not None:
-                       self._token = tokenGroup.group(1)
+                       raise RuntimeError("Could not extract authentication token from GrandCentral")
+               self._token = tokenGroup.group(1)
+
                anGroup = self._accountNumRe.search(accountNumberPage)
-               if anGroup is not None:
-                       self._accountNum = anGroup.group(1)
+               if atGroup is not None:
+                       raise RuntimeError("Could not extract account number from GrandCentral")
+               self._accountNum = anGroup.group(1)
 
                callbackPage = self._browser.download(self._forwardURL)
                self._callbackNumbers = {}