fix py3 xmlrpc imports, close #1473
This commit is contained in:
@@ -4,10 +4,8 @@ import os
|
||||
import re
|
||||
import gzip
|
||||
import tarfile
|
||||
from gluon._compat import StringIO
|
||||
from xmlrpclib import ProtocolError
|
||||
from gluon.contrib.simplejsonrpc import ServerProxy
|
||||
|
||||
from gluon._compat import StringIO, ProtocolError
|
||||
|
||||
def deploy():
|
||||
response.title = T('Deploy to pythonanywhere')
|
||||
|
||||
@@ -31,6 +31,7 @@ if PY2:
|
||||
from types import ClassType
|
||||
import cgi
|
||||
import cookielib
|
||||
from xmlrpclib import ProtocolError
|
||||
BytesIO = StringIO
|
||||
reduce = reduce
|
||||
hashlib_md5 = hashlib.md5
|
||||
@@ -94,6 +95,7 @@ else:
|
||||
from urllib.request import FancyURLopener, urlopen
|
||||
from urllib.parse import quote as urllib_quote, unquote as urllib_unquote, urlencode
|
||||
from http import cookiejar as cookielib
|
||||
from xmlrpc.client import ProtocolError
|
||||
import html # warning, this is the python3 module and not the web2py html module
|
||||
hashlib_md5 = lambda s: hashlib.md5(bytes(s, 'utf8'))
|
||||
iterkeys = lambda d: iter(d.keys())
|
||||
|
||||
@@ -17,12 +17,17 @@ __copyright__ = "Copyright (C) 2011 Mariano Reingart"
|
||||
__license__ = "LGPL 3.0"
|
||||
__version__ = "0.05"
|
||||
|
||||
import sys
|
||||
PY2 = sys.version_info[0] == 2
|
||||
|
||||
import urllib
|
||||
from xmlrpclib import Transport, SafeTransport
|
||||
from cStringIO import StringIO
|
||||
if PY2:
|
||||
from xmlrpclib import Transport, SafeTransport
|
||||
from cStringIO import StringIO
|
||||
else:
|
||||
from xmlrpc.client import Transport, SafeTransport
|
||||
from io import StringIO
|
||||
import random
|
||||
import sys
|
||||
import json
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user