[thorstenp] fix undefined variables
This commit is contained in:
parent
c2c681e05c
commit
dc5d7bcf7c
|
@ -46,8 +46,7 @@ from message_control import MessageControl
|
|||
from conversation_textview import ConversationTextview
|
||||
from message_textview import MessageTextView
|
||||
from common.contacts import GC_Contact
|
||||
from common.logger import Constants
|
||||
constants = Constants()
|
||||
from common.logger import constants
|
||||
from common.rst_xhtml_generator import create_xhtml
|
||||
from common.pep import MOODS, ACTIVITIES
|
||||
from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS
|
||||
|
@ -2370,7 +2369,7 @@ class ChatControl(ChatControlBase):
|
|||
pending_how_many, timeout, self.account)
|
||||
except exceptions.DatabaseMalformed:
|
||||
dialogs.ErrorDialog(_('Database Error'),
|
||||
_('The database file (%s) cannot be read. Try to repair it or remove it (all history will be lost).') % common.logger.LOG_DB_PATH)
|
||||
_('The database file (%s) cannot be read. Try to repair it or remove it (all history will be lost).') % constants.LOG_DB_PATH)
|
||||
rows = []
|
||||
local_old_kind = None
|
||||
for row in rows: # row[0] time, row[1] has kind, row[2] the message
|
||||
|
|
|
@ -145,7 +145,7 @@ class CapsCache(object):
|
|||
# prepopulate data which we are sure of; note: we do not log these info
|
||||
|
||||
for account in gajim.connections:
|
||||
gajimcaps = self[('sha-1', gajim.caps_hash[accout])]
|
||||
gajimcaps = self[('sha-1', gajim.caps_hash[account])]
|
||||
gajimcaps.identities = [gajim.gajim_identity]
|
||||
gajimcaps.features = gajim.gajim_common_features + \
|
||||
gajim.gajim_optional_features[account]
|
||||
|
|
|
@ -27,6 +27,7 @@ import os
|
|||
import sys
|
||||
import stat
|
||||
|
||||
import exceptions
|
||||
from common import gajim
|
||||
import logger
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ from errno import EWOULDBLOCK
|
|||
from errno import ENOBUFS
|
||||
from errno import EINTR
|
||||
from errno import EISCONN
|
||||
from errno import EINPROGRESS
|
||||
from xmpp.idlequeue import IdleObject
|
||||
MAX_BUFF_LEN = 65536
|
||||
|
||||
|
@ -902,10 +903,10 @@ class Socks5Receiver(Socks5, IdleObject):
|
|||
self._sock.setblocking(False)
|
||||
self._server=ai[4]
|
||||
break
|
||||
except Exception:
|
||||
if sys.exc_value[0] == errno.EINPROGRESS:
|
||||
except socket.error, e:
|
||||
if not isinstance(e, basestring) and e[0] == EINPROGRESS:
|
||||
break
|
||||
#for all errors, we try other addresses
|
||||
# for all other errors, we try other addresses
|
||||
continue
|
||||
self.fd = self._sock.fileno()
|
||||
self.state = 0 # about to be connected
|
||||
|
|
|
@ -283,7 +283,7 @@ class EncryptedStanzaSession(StanzaSession):
|
|||
return stanza
|
||||
|
||||
def is_xep_200_encrypted(self, msg):
|
||||
msg.getTag('c', namespace=common.xmpp.NS_STANZA_CRYPTO)
|
||||
msg.getTag('c', namespace=xmpp.NS_STANZA_CRYPTO)
|
||||
|
||||
def hmac(self, key, content):
|
||||
return HMAC.new(key, content, self.hash_alg).digest()
|
||||
|
|
|
@ -338,7 +338,7 @@ class NonBlockingNonSASL(PlugIn):
|
|||
self.DEBUG('waiting on handshake', 'notify')
|
||||
return
|
||||
self._owner.onreceive(None)
|
||||
owner._registered_name=self.user
|
||||
self._owner._registered_name=self.user
|
||||
if self.handshake+1:
|
||||
return self.on_auth('ok')
|
||||
self.on_auth(None)
|
||||
|
@ -437,12 +437,14 @@ class NBComponentBind(ComponentBind):
|
|||
|
||||
def Bind(self, domain = None, on_bind = None):
|
||||
''' Perform binding. Use provided domain name (if not provided). '''
|
||||
self._owner.onreceive(self._on_bound)
|
||||
def wrapper(resp):
|
||||
self._on_bound(resp, domain)
|
||||
self._owner.onreceive(wrapper)
|
||||
self.on_bind = on_bind
|
||||
|
||||
def _on_bound(self, resp):
|
||||
if data:
|
||||
self.Dispatcher.ProcessNonBlocking(data)
|
||||
def _on_bound(self, resp, domain=None):
|
||||
if resp:
|
||||
self.Dispatcher.ProcessNonBlocking(resp)
|
||||
if self.bound is None:
|
||||
return
|
||||
self._owner.onreceive(None)
|
||||
|
@ -450,7 +452,7 @@ class NBComponentBind(ComponentBind):
|
|||
Protocol('bind', attrs={'name':domain}, xmlns=NS_COMPONENT_1),
|
||||
func=self._on_bind_reponse)
|
||||
|
||||
def _on_bind_reponse(self, res):
|
||||
def _on_bind_reponse(self, resp):
|
||||
if resp and resp.getAttr('error'):
|
||||
self.DEBUG('Binding failed: %s.' % resp.getAttr('error'), 'error')
|
||||
elif resp:
|
||||
|
|
|
@ -31,6 +31,7 @@ What it supplies:
|
|||
A means of handling requests, by redirection though the command manager.
|
||||
"""
|
||||
|
||||
import math
|
||||
from protocol import *
|
||||
from client import PlugIn
|
||||
|
||||
|
@ -62,7 +63,7 @@ class Commands(PlugIn):
|
|||
def plugout(self):
|
||||
"""Removes handlers from the session"""
|
||||
# unPlug from the session and the disco manager
|
||||
self._owner.UnregisterHandler('iq',self_CommandHandler,ns=NS_COMMANDS)
|
||||
self._owner.UnregisterHandler('iq',self._CommandHandler,ns=NS_COMMANDS)
|
||||
for jid in self._handlers:
|
||||
self._browser.delDiscoHandler(self._DiscoHandler,node=NS_COMMANDS)
|
||||
|
||||
|
@ -281,10 +282,10 @@ class TestCommand(Command_Handler_Prototype):
|
|||
session = None
|
||||
if session is None:
|
||||
session = self.getSessionID()
|
||||
sessions[session]={'jid':request.getFrom(),'actions':{'cancel':self.cmdCancel,'next':self.cmdSecondStage},'data':{'type':None}}
|
||||
self.sessions[session]={'jid':request.getFrom(),'actions':{'cancel':self.cmdCancel,'next':self.cmdSecondStage},'data':{'type':None}}
|
||||
# As this is the first stage we only send a form
|
||||
reply = request.buildReply('result')
|
||||
form = DataForm(title='Select type of operation',data=['Use the combobox to select the type of calculation you would like to do, then click Next',DataField(name='calctype',label='Calculation Type',value=sessions[session]['data']['type'],options=[['circlediameter','Calculate the Diameter of a circle'],['circlearea','Calculate the area of a circle']],typ='list-single',required=1)])
|
||||
form = DataForm(title='Select type of operation',data=['Use the combobox to select the type of calculation you would like to do, then click Next',DataField(name='calctype',label='Calculation Type',value=self.sessions[session]['data']['type'],options=[['circlediameter','Calculate the Diameter of a circle'],['circlearea','Calculate the area of a circle']],typ='list-single',required=1)])
|
||||
replypayload = [Node('actions',attrs={'execute':'next'},payload=[Node('next')]),form]
|
||||
reply.addChild(name='command',attrs={'xmlns':NS_COMMAND,'node':request.getTagAttr('command','node'),'sessionid':session,'status':'executing'},payload=replypayload)
|
||||
self._owner.send(reply)
|
||||
|
@ -312,9 +313,9 @@ class TestCommand(Command_Handler_Prototype):
|
|||
except Exception:
|
||||
self.cmdSecondStageReply(conn,request)
|
||||
if sessions[request.getTagAttr('command','sessionid')]['data']['type'] == 'circlearea':
|
||||
result = num*(pi**2)
|
||||
result = num*(math.pi**2)
|
||||
else:
|
||||
result = num*2*pi
|
||||
result = num*2*math.pi
|
||||
reply = result.buildReply(request)
|
||||
form = DataForm(typ='result',data=[DataField(label='result',name='result',value=result)])
|
||||
reply.addChild(name='command',attrs={'xmlns':NS_COMMAND,'node':request.getTagAttr('command','node'),'sessionid':request.getTagAttr('command','sessionid'),'status':'completed'},payload=form)
|
||||
|
@ -325,8 +326,8 @@ class TestCommand(Command_Handler_Prototype):
|
|||
reply = request.buildReply('result')
|
||||
reply.addChild(name='command',attrs={'xmlns':NS_COMMAND,'node':request.getTagAttr('command','node'),'sessionid':request.getTagAttr('command','sessionid'),'status':'cancelled'})
|
||||
self._owner.send(reply)
|
||||
del sessions[request.getTagAttr('command','sessionid')]
|
||||
del self.sessions[request.getTagAttr('command','sessionid')]
|
||||
|
||||
|
||||
|
||||
# vim: se ts=3:
|
||||
# vim: se ts=3:
|
||||
|
|
|
@ -24,6 +24,8 @@ writing the server.
|
|||
|
||||
__version__="$Id"
|
||||
|
||||
import random
|
||||
import simplexml
|
||||
from protocol import *
|
||||
|
||||
# Transport-level flags
|
||||
|
|
|
@ -139,10 +139,10 @@ class SSLWrapper:
|
|||
can indicate that the socket has been closed, so to be sure, we avoid
|
||||
this by returning None. """
|
||||
|
||||
raise NotImplementedException()
|
||||
raise NotImplementedError()
|
||||
|
||||
def send(self, data, flags=None, now = False):
|
||||
raise NotImplementedException()
|
||||
raise NotImplementedError()
|
||||
|
||||
class PyOpenSSLWrapper(SSLWrapper):
|
||||
'''Wrapper class for PyOpenSSL's recv() and send() methods'''
|
||||
|
|
|
@ -31,8 +31,8 @@ def test_bonjour():
|
|||
try:
|
||||
import pybonjour
|
||||
except ImportError:
|
||||
return False
|
||||
except WindowsError:
|
||||
return False
|
||||
except WindowsError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -46,4 +46,4 @@ elif test_bonjour():
|
|||
from common.zeroconf import zeroconf_bonjour
|
||||
Zeroconf = zeroconf_bonjour.Zeroconf
|
||||
|
||||
# vim: se ts=3:
|
||||
# vim: se ts=3:
|
||||
|
|
|
@ -251,7 +251,7 @@ class Zeroconf:
|
|||
self.announced = False
|
||||
return True
|
||||
except pybonjour.BonjourError, e:
|
||||
geajim.log.debug(e)
|
||||
gajim.log.debug(e)
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ from common import connection
|
|||
from common import passwords
|
||||
from common import zeroconf
|
||||
from common import dataforms
|
||||
from common import GnuPG
|
||||
|
||||
from common.exceptions import GajimGeneralException
|
||||
|
||||
|
|
|
@ -1577,7 +1577,7 @@ class DubbleInputDialog:
|
|||
|
||||
def on_cancelbutton_clicked(self, widget):
|
||||
self.dialog.destroy()
|
||||
if not cancel_handler:
|
||||
if not self.cancel_handler:
|
||||
return
|
||||
if isinstance(self.cancel_handler, tuple):
|
||||
self.cancel_handler[0](*self.cancel_handler[1:])
|
||||
|
|
|
@ -104,6 +104,6 @@ if os.name == 'nt' or not sys.stderr.isatty():
|
|||
if __name__ == '__main__':
|
||||
_excepthook_save = sys.excepthook
|
||||
sys.excepthook = _info
|
||||
print x # this always tracebacks
|
||||
raise Exception()
|
||||
|
||||
# vim: se ts=3:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
from distutils.core import setup, Extension
|
||||
import commands
|
||||
|
||||
|
@ -26,4 +27,4 @@ setup(name='syncmenu', version='0.2',
|
|||
extra_compile_args=['-Wall'] + cflags)
|
||||
])
|
||||
|
||||
# vim: se ts=3:
|
||||
# vim: se ts=3:
|
||||
|
|
|
@ -327,7 +327,7 @@ class SignalObject(dbus.service.Object):
|
|||
'''Shows the tabbed window for new message to 'jid', using account
|
||||
(optional) 'account' '''
|
||||
if not jid:
|
||||
raise MissingArgument
|
||||
raise dbus_support.MissingArgument()
|
||||
jid = self._get_real_jid(jid, account)
|
||||
try:
|
||||
jid = helpers.parse_jid(jid)
|
||||
|
@ -407,7 +407,7 @@ class SignalObject(dbus.service.Object):
|
|||
if not isinstance(jid, unicode):
|
||||
jid = unicode(jid)
|
||||
if not jid:
|
||||
raise MissingArgument
|
||||
raise dbus_support.MissingArgument()
|
||||
jid = self._get_real_jid(jid)
|
||||
|
||||
cached_vcard = gajim.connections.values()[0].get_cached_vcard(jid)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
from common.configpaths import gajimpaths
|
||||
|
||||
import Crypto
|
||||
from common import crypto
|
||||
from common import exceptions
|
||||
|
||||
|
|
Loading…
Reference in New Issue