Commits

mdelagra committed fc65e3d

applying patch

  • Participants
  • Parent commits 4b94709

Comments (0)

Files changed (1)

File mercurial_reviewboard/reviewboard.py

         try:
             r = ApiRequest(method, url, body, headers)
             data = urllib2.urlopen(r).read()
-            self._cj.save(self.cookie_file)
+            try:
+                self._cj.save(self.cookie_file)
+            except:
+                pass
             return data
         except urllib2.HTTPError, e:
             if not hasattr(e, 'code'):
         return self._api_request('POST', url, fields, files)
 
     def login(self, username=None, password=None):
-        if not username and not password and self._httpclient.has_valid_cookie():
-            return
+        if not username and not password:
+            if self._httpclient.has_valid_cookie():
+                return
 
         if not username:
             username = mercurial.ui.ui().prompt('Username: ')
 def make_rbclient(url, username, password, proxy=None, apiver=''):
     httpclient = HttpClient(url, proxy)
 
-    if not httpclient.has_valid_cookie():
-        if not username:
-            username = mercurial.ui.ui().prompt('Username: ')
-        if not password:
-            password = getpass.getpass('Password: ')
+    if not username and not password:
+            if httpclient.has_valid_cookie():
+                return
+    
+    if not username:
+        username = mercurial.ui.ui().prompt('Username: ')
+    if not password:
+        password = getpass.getpass('Password: ')
 
     httpclient.set_credentials(username, password)