fixed python 2.4 compatibility (#1)
This commit is contained in:
parent
d774400e7b
commit
f0d097e006
@ -8,6 +8,7 @@
|
|||||||
:copyright: 2007 by Armin Ronacher.
|
:copyright: 2007 by Armin Ronacher.
|
||||||
:license: BSD
|
:license: BSD
|
||||||
"""
|
"""
|
||||||
|
import sys
|
||||||
import re
|
import re
|
||||||
import inspect
|
import inspect
|
||||||
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
|
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
|
||||||
@ -20,7 +21,12 @@ _strip_re = re.compile(r'[\x00-\x08\x0B-\x1F]')
|
|||||||
class XMLRPCRequestHandler(SimpleXMLRPCDispatcher):
|
class XMLRPCRequestHandler(SimpleXMLRPCDispatcher):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
SimpleXMLRPCDispatcher.__init__(self, True, 'utf-8')
|
#: Python 2.5 requires some arguments like `allow_none`
|
||||||
|
#: and the encoding. Python 2.4 and 2.3 doesn't.
|
||||||
|
if sys.version_info[:2] < (2, 5):
|
||||||
|
SimpleXMLRPCDispatcher.__init__(self)
|
||||||
|
else:
|
||||||
|
SimpleXMLRPCDispatcher.__init__(self, True, 'utf-8')
|
||||||
self.funcs['system.listMethods'] = self.list_methods
|
self.funcs['system.listMethods'] = self.list_methods
|
||||||
|
|
||||||
def list_methods(self, request):
|
def list_methods(self, request):
|
||||||
|
@ -9,7 +9,10 @@
|
|||||||
:license: BSD
|
:license: BSD
|
||||||
"""
|
"""
|
||||||
import time
|
import time
|
||||||
from hashlib import sha1
|
try:
|
||||||
|
from hashlib import sha1
|
||||||
|
except:
|
||||||
|
from sha import new as sha1
|
||||||
from random import random
|
from random import random
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from werkzeug import Local, LocalManager, LocalProxy, BaseRequest, \
|
from werkzeug import Local, LocalManager, LocalProxy, BaseRequest, \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user