1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Migrate source code to python 3.7 and refine code style

This commit is contained in:
Gao Jiangmiao 2019-08-16 12:59:37 +08:00
parent 0e231a930d
commit a4d74a09a6
55 changed files with 192 additions and 306 deletions

View file

@ -20,11 +20,11 @@ django.setup()
# sys.path.append(VENV_PATH)
import re
import Cookie
import http.cookies
import socket
from webvirtcloud.settings import WS_PORT, WS_HOST, WS_CERT
from vrtManager.connection import CONN_SSH, CONN_SOCKET
from tunnel import Tunnel
from console.tunnel import Tunnel
from optparse import OptionParser
parser = OptionParser()
@ -120,7 +120,7 @@ def get_connection_infos(token):
console_host = conn.get_console_listen_addr()
console_port = conn.get_console_port()
console_socket = conn.get_console_socket()
except Exception, e:
except Exception as e:
logging.error('Fail to retrieve console connection infos for token %s : %s' % (token, e))
raise
return (connhost, connport, connuser, conntype, console_host,
@ -129,7 +129,7 @@ def get_connection_infos(token):
class CompatibilityMixIn(object):
def _new_client(self, daemon, socket_factory):
cookie = Cookie.SimpleCookie()
cookie = http.cookies.SimpleCookie()
cookie.load(self.headers.getheader('cookie'))
if 'token' not in cookie:
self.msg('No token cookie found !')

View file

@ -27,6 +27,7 @@ import os
import socket
import signal
import logging
from functools import reduce
class Tunnel(object):

View file

@ -1,7 +1,5 @@
import re
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from instances.models import Instance
from vrtManager.instance import wvmInstance