File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -822,9 +822,7 @@ def clear_text(self):
822822 self .text = None
823823
824824 def __eq__ (self , other ):
825- try :
826- assert isinstance (other , SamlBase )
827- except AssertionError :
825+ if not isinstance (other , SamlBase ):
828826 return False
829827
830828 self .clear_text ()
Original file line number Diff line number Diff line change @@ -356,7 +356,8 @@ def split_len(seq, length):
356356
357357
358358def to_time (_time ):
359- assert _time .endswith (' GMT' )
359+ if not _time .endswith (' GMT' ):
360+ raise Exception ('Time does not end with GMT' )
360361 _time = _time [:- 4 ]
361362 return mktime (str_to_time (_time , M2_TIME_FORMAT ))
362363
@@ -372,8 +373,10 @@ def active_cert(key):
372373 try :
373374 cert_str = pem_format (key )
374375 cert = crypto .load_certificate (crypto .FILETYPE_PEM , cert_str )
375- assert cert .has_expired () == 0
376- assert not OpenSSLWrapper ().certificate_not_valid_yet (cert )
376+ if not cert .has_expired () == 0 :
377+ raise Exception ('Cert is expired.' )
378+ if OpenSSLWrapper ().certificate_not_valid_yet (cert ):
379+ raise Exception ('Certificate not valid yet.' )
377380 return True
378381 except AssertionError :
379382 return False
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ def parse_duration(duration):
6767 index += 1
6868 else :
6969 sign = '+'
70- assert duration [index ] == "P"
70+ if duration [index ] != "P" :
71+ raise Exception ('Parse Duration is not valid.' )
7172 index += 1
7273
7374 dic = dict ([(typ , 0 ) for (code , typ ) in D_FORMAT if typ ])
You can’t perform that action at this time.
0 commit comments