py2 -> py3

This commit is contained in:
Yann Leboulanger 2013-12-30 21:19:15 +01:00
parent 54c3f9acaa
commit d337aeed4e
7 changed files with 11 additions and 10 deletions

View File

@ -1216,7 +1216,7 @@ class GcInvitationReceivedEvent(nec.NetworkIncomingEvent):
self.is_continued = False
if invite_tag.getAttr('continue') == 'true':
self.is_continued = True
else
else:
self.room_jid = self.msg_obj.fjid
item = self.msg_obj.invite_tag.getTag('invite')
try:

View File

@ -87,7 +87,7 @@ def add_entropy_sources_OpenSSL():
os.environ, os.getcwd(), os.getpid()]
for s in sources:
OpenSSL.rand.add(str(s), 0.01)
OpenSSL.rand.add(str(s).encode('utf-8'), 0.01)
# On Windows add the current contents of the screen to the PRNG state.
if os.name == 'nt':
@ -99,12 +99,13 @@ def add_entropy_sources_OpenSSL():
for d in dirs:
if os.access(d, os.R_OK):
for filename in os.listdir(d):
OpenSSL.rand.add(filename, 0)
OpenSSL.rand.add(filename.encode('utf-8'), 0)
try:
with open(d + os.sep + filename, "r") as fp:
# Limit the ammount of read bytes, in case a memory
# file was opened
OpenSSL.rand.add(str(fp.read(5000)), 0.01)
OpenSSL.rand.add(str(fp.read(5000)).encode('utf-8'),
0.01)
except:
# Ignore all read and access errors
pass

View File

@ -21,8 +21,8 @@ import os
from common import gajim
import nbxmpp
from common.jingle_transport import JingleTransportIBB
from jingle_xtls import SELF_SIGNED_CERTIFICATE
from jingle_xtls import load_cert_file
from .jingle_xtls import SELF_SIGNED_CERTIFICATE
from .jingle_xtls import load_cert_file
contents = {}

View File

@ -22,7 +22,7 @@ Handles Jingle File Transfer (XEP 0234)
import hashlib
from common import gajim
import nbxmpp
import jingle_xtls
from . import jingle_xtls
from common.jingle_content import contents, JingleContent
from common.jingle_transport import *
from common import helpers

View File

@ -286,7 +286,7 @@ def make_certs(filepath, CN):
req = createCertRequest(key, CN=CN)
cert = createCertificate(req, req, key, 0, 0, 60*60*24*365*5) # five years
with open(filepath + '.pkey', 'wb') as f:
os.chmod(filepath + '.pkey', 0600)
os.chmod(filepath + '.pkey', 0o600)
f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, key))
with open(filepath + '.cert', 'wb') as f:
f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert).decode(

View File

@ -494,7 +494,7 @@ class Socks5(object):
self._sock.connect(self._server)
self._send=self._sock.send
self._recv=self._sock.recv
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError), e:
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError) as e:
pass
except Exception as ee:
errnum = ee.errno

View File

@ -1971,7 +1971,7 @@ class Interface:
import imp
imp.reload(emoticons)
emots = emoticons.emoticons
except Exception, e:
except Exception as e:
return True
for emot_filename in emots:
emot_file = os.path.join(path, emot_filename)