Achieve Python 2/3 compatibility.

This commit is contained in:
Michael Hierweck 2016-05-28 22:43:17 +02:00
parent a85e289927
commit 79cc5c7d40
2 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,10 @@
""" This module provides a class that implements the HSAdmin API.
"""
from xmlrpclib import ServerProxy
try:
from xmlrpclib import ServerProxy
except ImportError:
from xmlrpc.client import ServerProxy
from .dispatcher import Dispatcher
from .session import Session
@ -30,7 +33,7 @@ class API(object):
modules[module] = backend
meta[backend][module] = dict()
for prop in [prop for prop in props
if prop.has_key('module') and (prop['module'] == module)]:
if ('module' in prop) and (prop['module'] == module)]:
del prop['module']
meta[backend][module][prop['name']] = prop

View File

@ -1,8 +1,12 @@
""" This module provides a directly callable class that implements a remote method invokation.
"""
from xmlrpclib import ServerProxy
from xmlrpclib import Fault
try:
from xmlrpclib import ServerProxy
from xmlrpclib import Fault
except ImportError:
from xmlrpc.client import ServerProxy
from xmlrpc.client import Fault
from .exceptions import ProxyError