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