mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Set the default Int maxvalue to the maximum XML-RPC can handle.
Also handle marshalling errors thrown by xmlrpclib more gracefully. ticket 770
This commit is contained in:
parent
ec3e7f1202
commit
886e417fd7
@ -420,6 +420,20 @@ class JSONError(PublicError):
|
||||
format = _('Invalid JSON-RPC request: %(error)s')
|
||||
|
||||
|
||||
class XMLRPCMarshallError(PublicError):
|
||||
"""
|
||||
**910** Raised when the XML-RPC lib cannot marshall the request
|
||||
|
||||
For example:
|
||||
|
||||
>>> raise XMLRPCMarshallError(error='int exceeds XML-RPC limits')
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
XMLRPCMarshallError: error marshalling data for XML-RPC transport: int exceeds XML-RPC limits
|
||||
"""
|
||||
|
||||
errno = 910
|
||||
format = _('error marshalling data for XML-RPC transport: %(error)s')
|
||||
|
||||
##############################################################################
|
||||
# 1000 - 1999: Authentication errors
|
||||
|
@ -109,6 +109,7 @@ from errors import PasswordMismatch
|
||||
from constants import NULLS, TYPE_ERROR, CALLABLE_ERROR
|
||||
from text import Gettext, FixMe
|
||||
import csv
|
||||
from xmlrpclib import MAXINT
|
||||
|
||||
|
||||
class DefaultFrom(ReadOnly):
|
||||
@ -1002,7 +1003,7 @@ class Int(Number):
|
||||
|
||||
kwargs = Param.kwargs + (
|
||||
('minvalue', int, None),
|
||||
('maxvalue', int, None),
|
||||
('maxvalue', int, int(MAXINT)),
|
||||
)
|
||||
|
||||
def __init__(self, name, *rules, **kw):
|
||||
|
@ -38,7 +38,7 @@ import errno
|
||||
from xmlrpclib import Binary, Fault, dumps, loads, ServerProxy, Transport, ProtocolError
|
||||
import kerberos
|
||||
from ipalib.backend import Connectible
|
||||
from ipalib.errors import public_errors, PublicError, UnknownError, NetworkError, KerberosError
|
||||
from ipalib.errors import public_errors, PublicError, UnknownError, NetworkError, KerberosError, XMLRPCMarshallError
|
||||
from ipalib import errors
|
||||
from ipalib.request import context
|
||||
from ipapython import ipautil, dnsclient
|
||||
@ -373,3 +373,5 @@ class xmlclient(Connectible):
|
||||
raise NetworkError(uri=server, error=e.errmsg)
|
||||
except socket.error, e:
|
||||
raise NetworkError(uri=server, error=str(e))
|
||||
except (OverflowError, TypeError), e:
|
||||
raise XMLRPCMarshallError(error=str(e))
|
||||
|
Loading…
Reference in New Issue
Block a user