fix string exceptions
This commit is contained in:
parent
5eb402ba4b
commit
f0dce41ab6
|
@ -401,7 +401,7 @@ class EncryptedStanzaSession(StanzaSession):
|
||||||
pubkey_o = xmpp.c14n.c14n(keyvalue)
|
pubkey_o = xmpp.c14n.c14n(keyvalue)
|
||||||
else:
|
else:
|
||||||
# XXX DSA, etc.
|
# XXX DSA, etc.
|
||||||
raise 'unimplemented'
|
raise NotImplementedError()
|
||||||
|
|
||||||
enc_sig = parsed.getTag(name='SignatureValue',
|
enc_sig = parsed.getTag(name='SignatureValue',
|
||||||
namespace=XmlDsig).getData()
|
namespace=XmlDsig).getData()
|
||||||
|
|
|
@ -120,7 +120,7 @@ class Browser(PlugIn):
|
||||||
elif set_ or '' in cur: return cur,''
|
elif set_ or '' in cur: return cur,''
|
||||||
else: return None,None
|
else: return None,None
|
||||||
if 1 in cur or set_: return cur,1
|
if 1 in cur or set_: return cur,1
|
||||||
raise "Corrupted data"
|
raise Exception("Corrupted data")
|
||||||
|
|
||||||
def setDiscoHandler(self,handler,node='',jid=''):
|
def setDiscoHandler(self,handler,node='',jid=''):
|
||||||
""" This is the main method that you will use in this class.
|
""" This is the main method that you will use in this class.
|
||||||
|
|
|
@ -175,8 +175,7 @@ class Debug:
|
||||||
self._fh = sys.stdout
|
self._fh = sys.stdout
|
||||||
|
|
||||||
if time_stamp not in (0,1,2):
|
if time_stamp not in (0,1,2):
|
||||||
msg2 = '%s' % time_stamp
|
raise Exception('Invalid time_stamp param "%s"' % str(time_stamp))
|
||||||
raise 'Invalid time_stamp param', msg2
|
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
self.sufix = sufix
|
self.sufix = sufix
|
||||||
self.time_stamp = time_stamp
|
self.time_stamp = time_stamp
|
||||||
|
@ -198,12 +197,8 @@ class Debug:
|
||||||
if type(flag_show) in (str, type(None)):
|
if type(flag_show) in (str, type(None)):
|
||||||
self.flag_show = flag_show
|
self.flag_show = flag_show
|
||||||
else:
|
else:
|
||||||
msg2 = '%s' % type(flag_show )
|
raise Exception('Invalid type "%s" for flag_show!' % \
|
||||||
raise 'Invalid type for flag_show!', msg2
|
type(flag_show))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def show( self, msg, flag = None, prefix = None, sufix = None,
|
def show( self, msg, flag = None, prefix = None, sufix = None,
|
||||||
lf = 0 ):
|
lf = 0 ):
|
||||||
|
@ -341,7 +336,8 @@ class Debug:
|
||||||
"""filter out any dupes."""
|
"""filter out any dupes."""
|
||||||
if not isinstance(item, str):
|
if not isinstance(item, str):
|
||||||
msg2 = '%s' % item
|
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:
|
if item not in lst:
|
||||||
lst.append( item )
|
lst.append( item )
|
||||||
return lst
|
return lst
|
||||||
|
@ -353,7 +349,7 @@ class Debug:
|
||||||
for f in self._as_one_list( flags ):
|
for f in self._as_one_list( flags ):
|
||||||
if not f in self.debug_flags:
|
if not f in self.debug_flags:
|
||||||
msg2 = '%s' % f
|
msg2 = '%s' % f
|
||||||
raise 'Invalid debugflag given', msg2
|
raise Exception('Invalid debugflag "%s" given' % f)
|
||||||
|
|
||||||
def _remove_dupe_flags( self ):
|
def _remove_dupe_flags( self ):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -317,12 +317,16 @@ class Session:
|
||||||
|
|
||||||
def start_feature(self,f):
|
def start_feature(self,f):
|
||||||
""" Declare some feature as "negotiating now" to prevent other features from start negotiating. """
|
""" 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
|
self.feature_in_process=f
|
||||||
|
|
||||||
def stop_feature(self,f):
|
def stop_feature(self,f):
|
||||||
""" Declare some feature as "negotiated" to allow other features start negotiating. """
|
""" 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
|
self.feature_in_process=None
|
||||||
|
|
||||||
def set_socket_state(self,newstate):
|
def set_socket_state(self,newstate):
|
||||||
|
|
Loading…
Reference in New Issue