fixed python 2.4 compatibility (#1)

This commit is contained in:
entequak 2007-12-23 13:30:36 +01:00
parent d774400e7b
commit f0d097e006
2 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,7 @@
:copyright: 2007 by Armin Ronacher.
:license: BSD
"""
import sys
import re
import inspect
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
@ -20,7 +21,12 @@ _strip_re = re.compile(r'[\x00-\x08\x0B-\x1F]')
class XMLRPCRequestHandler(SimpleXMLRPCDispatcher):
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
def list_methods(self, request):

View File

@ -9,7 +9,10 @@
:license: BSD
"""
import time
from hashlib import sha1
try:
from hashlib import sha1
except:
from sha import new as sha1
from random import random
from types import ModuleType
from werkzeug import Local, LocalManager, LocalProxy, BaseRequest, \