diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py index 15bebafa12e6fb20607d3497af62242e12001ef1..3797fd428921a8919f98b8f0e67142ea1f4a7056 100644 --- a/src/common/stanza_session.py +++ b/src/common/stanza_session.py @@ -401,7 +401,7 @@ class EncryptedStanzaSession(StanzaSession): pubkey_o = xmpp.c14n.c14n(keyvalue) else: # XXX DSA, etc. - raise 'unimplemented' + raise NotImplementedError() enc_sig = parsed.getTag(name='SignatureValue', namespace=XmlDsig).getData() diff --git a/src/common/xmpp/browser.py b/src/common/xmpp/browser.py index 10b9d0364afe52bf609317f74c7109ebcbf656eb..0a3d78f5506975a2118dfdc00f7025167ef5c7a8 100644 --- a/src/common/xmpp/browser.py +++ b/src/common/xmpp/browser.py @@ -120,7 +120,7 @@ class Browser(PlugIn): elif set_ or '' in cur: return cur,'' else: return None,None if 1 in cur or set_: return cur,1 - raise "Corrupted data" + raise Exception("Corrupted data") def setDiscoHandler(self,handler,node='',jid=''): """ This is the main method that you will use in this class. diff --git a/src/common/xmpp/debug.py b/src/common/xmpp/debug.py index fc3458d454e7d3d39dc04ee4043c47c3d9a71916..769f09f19d56a08d4af7f8504bab78cf2397b5da 100644 --- a/src/common/xmpp/debug.py +++ b/src/common/xmpp/debug.py @@ -175,8 +175,7 @@ class Debug: self._fh = sys.stdout if time_stamp not in (0,1,2): - msg2 = '%s' % time_stamp - raise 'Invalid time_stamp param', msg2 + raise Exception('Invalid time_stamp param "%s"' % str(time_stamp)) self.prefix = prefix self.sufix = sufix self.time_stamp = time_stamp @@ -198,12 +197,8 @@ class Debug: if type(flag_show) in (str, type(None)): self.flag_show = flag_show else: - msg2 = '%s' % type(flag_show ) - raise 'Invalid type for flag_show!', msg2 - - - - + raise Exception('Invalid type "%s" for flag_show!' % \ + type(flag_show)) def show( self, msg, flag = None, prefix = None, sufix = None, lf = 0 ): @@ -341,7 +336,8 @@ class Debug: """filter out any dupes.""" if not isinstance(item, str): msg2 = '%s' % item - raise 'Invalid item type (should be string)',msg2 + raise Exception('Invalid item type "%s", should be string' % \ + type(item)) if item not in lst: lst.append( item ) return lst @@ -353,7 +349,7 @@ class Debug: for f in self._as_one_list( flags ): if not f in self.debug_flags: msg2 = '%s' % f - raise 'Invalid debugflag given', msg2 + raise Exception('Invalid debugflag "%s" given' % f) def _remove_dupe_flags( self ): """ diff --git a/src/common/xmpp/session.py b/src/common/xmpp/session.py index 256de179511b4b243392132be8edf1d6b701dbf0..0e77020787cdb9802031467003248f66ffba8039 100644 --- a/src/common/xmpp/session.py +++ b/src/common/xmpp/session.py @@ -317,12 +317,16 @@ class Session: def start_feature(self,f): """ Declare some feature as "negotiating now" to prevent other features from start negotiating. """ - if self.feature_in_process: raise "Starting feature %s over %s !"%(f,self.feature_in_process) + if self.feature_in_process: + raise Exception("Starting feature %s over %s !" % (f, + self.feature_in_process) self.feature_in_process=f def stop_feature(self,f): """ Declare some feature as "negotiated" to allow other features start negotiating. """ - if self.feature_in_process!=f: raise "Stopping feature %s instead of %s !"%(f,self.feature_in_process) + if self.feature_in_process != f: + raise Exception("Stopping feature %s instead of %s !" % (f, + self.feature_in_process) self.feature_in_process=None def set_socket_state(self,newstate):