Commits

Shuge Lee committed 43595af

small changed

  • Participants
  • Parent commits fd9266e

Comments (0)

Files changed (4)

File demos/demo_send_sms.py

 user_obj = sipc.User(my_account.account_id, my_account.passwd,
                        app_data_path = app_data_path)
 
-http_resp_obj = sipc.ssi_app_sign_in(user_obj)
+http_resp_obj = sipc.single_sign_in(user_obj)
 assert http_resp_obj.status == httplib.OK
 user_obj.update_user_info_from_ssi_sign_in_resp(ssi_resp = http_resp_obj)
 

File demos/demo_single_sign_in.py

 user_obj.sys_config = sys_config_obj
 
 
-resp_obj = sipc.ssi_app_sign_in(user_obj)
+resp_obj = sipc.single_sign_in(user_obj)
 resp_status = resp_obj.status
 
 while resp_status != httplib.OK:
         account_id = raw_input("account ID: ")
         passwd = getpass.getpass("passwd: ")
 
-        resp_obj = sipc.ssi_app_sign_in(user_obj)
+        resp_obj = sipc.single_sign_in(user_obj)
 
     elif resp_status == httplib.BAD_REQUEST:
         msg = "account is wrong"
 
         user_obj = sipc.User(account_id, passwd)
         user_obj.sys_config = sys_config_obj
-        resp_obj = sipc.ssi_app_sign_in(user_obj)
+        resp_obj = sipc.single_sign_in(user_obj)
 
     elif resp_status in (sipc.HTTPResponse.NEED_VERIFY, sipc.HTTPResponse.CAPTCHA_FAILED):
         msg = "user have to recognise captcha image"
         os.close(file_desc)
         os.remove(captcha_rec.captcha_img_save_path)
 
-        resp_obj = sipc.ssi_app_sign_in(user_obj, captcha_rec)
+        resp_obj = sipc.single_sign_in(user_obj, captcha_rec)
 
     elif resp_status == sipc.HTTPResponse.NEED_BIND_TO_EMAIL_OR_CELLPHONE_NO:
         msg = "you have to bind this sipc No. to a E-Mail or cellphone No." + '\n'

File sipc/commons/threadutils.py

             try:
                 self._func(*self._args, **self._kwargs)
             except Exception, ex:
-                if len(ex.args) == 1:
+                if ex.args[0] == errno.EPIPE:
                     self._finished.set()
-                    raise Exception(ex)
-                    # return
-                elif len(ex.args) >= 2:
-                    err_no, err_msg = ex.args[0], ex.args[1]
-                    if err_no == errno.EPIPE:
-                        self._finished.set()
-                    raise Exception(ex)                        
-                    # return
                 else:
-                    raise Exception(ex)
+                    raise ex
 
             self._finished.wait(self._interval)
         self._finished.set()
 import user
 
 __all__ = [
-    "ssi_app_sign_in",
+    "single_sign_in",
 ]
 
 
         return user.User.ACCOUNT_ID_SID
 
 
-def ssi_app_sign_in(user_obj, captcha_rec = None):
+def single_sign_in(user_obj, captcha_rec = None):
     """  I won't use httplib2(supports HTTPS) library in this project,
     httplib2 auto does lower() for all header fields of request or response,
     header fields in lower is valid in HTTP/1.1 [rfc2616], but it doesn't works in SIP-C.