[spyne] The helpfulness of logs, validation error contains no reference to the key

Alex ralienpp at gmail.com
Thu Jun 5 15:57:17 UTC 2014


Hi,


I need some help with understanding the cause of such behaviour. Spyne
2.10.10 says:

ERROR:spyne.server.wsgi:Fault(Client.ValidationError: 'The value
"u\'\'" could not be validated.')

Obviously, one of the several empty values is not right, but which
one? The error contains just the value, but it would be more helpful
if it included the key too.


The tricky part is that having looked through the code of dictdoc.py,
I found that _from_dict_value() raises ValidationError exceptions and
passes the key and the value to them. Thus I am surprised that I am
not seeing that in the log, even though I have the latest 2.10.10.



Another question is why does it say `"u\'\'"`, instead of showing an
empty string?



I would greatly appreciate some hints about this matter,
Alex



#note, the personal data are fake
DEBUG:spyne.protocol.dictdoc:   body   : {u'RegisterUser': {u'data':
{u'passportData': {u'series': u'', u'issuer': u'Frichten Shrubber',
u'docType': u'', u'dateIssued': u'1901-02-3', u'number': u'HGY00999'},
u'c
n': u'Shulz Ivanov', u'userAuthenticationOptions': u'',
u'localityName': u'China', u'userExternalCertificate': u'',
u'additionalPhone': u'', u'title': u'', u'dateOfBirth': u'1917-02-18',
u'streetAddr
ess': u'Valea Trandafirilor', u'phoneNumber': u'37266554433',
u'department': u'', u'mail': u'popov at example.com', u'postalAddress':
u'', u'mobilePhone': u'', u'postalCode': u'LK8877', u'homePhone': u'',
u'userName
': u'popov', u'on': u'', u'c': u'MD', u'displayName': u'popov',
u'stateOrProvinceName': u'CU', u'sn': u'Ivanov', u'ou': u'',
u'givenName': u'rasta'}}}
ERROR:spyne.server._base:Fault(Client.ValidationError: 'The value
"u\'\'" could not be validated.')
Traceback (most recent call last):
  File "/home/alex/neto/venv/local/lib/python2.7/site-packages/spyne/server/_base.py",
line 82, in get_in_object
    message=self.app.in_protocol.REQUEST)
  File "/home/alex/neto/venv/local/lib/python2.7/site-packages/spyne/protocol/dictdoc.py",
line 422, in deserialize
    self.validator)
  File "/home/alex/neto/venv/local/lib/python2.7/site-packages/spyne/protocol/dictdoc.py",
line 541, in _doc_to_object
    value = self._from_dict_value(member, v, validator)
  File "/home/alex/neto/venv/local/lib/python2.7/site-packages/spyne/protocol/dictdoc.py",
line 476, in _from_dict_value
    retval = self._doc_to_object(class_, value, validator)
  File "/home/alex/neto/venv/local/lib/python2.7/site-packages/spyne/protocol/dictdoc.py",
line 541, in _doc_to_object
    value = self._from_dict_value(member, v, validator)
  File "/home/alex/neto/venv/local/lib/python2.7/site-packages/spyne/protocol/dictdoc.py",
line 482, in _from_dict_value
    raise ValidationError(value)
ValidationError: Fault(Client.ValidationError: 'The value "u\'\'"
could not be validated.')
ERROR:spyne.server.wsgi:Fault(Client.ValidationError: 'The value
"u\'\'" could not be validated.')
192.168.1.13 - - [05/Jun/2014 15:45:01] "POST / HTTP/1.1" 400 115


More information about the people mailing list