[spyne] String constraints and enums

Alex ralienpp at gmail.com
Tue Jun 17 12:14:13 UTC 2014


Hi,

I'm struggling with the following situation. There's a data type
defined as follows:

RequestStatus = Unicode(values=['new', 'processed'])


When I send a request, Spyne (the latest version from the git repo)
returns the following error:
ValidationError: Fault(Client.ValidationError: 'The value "u\'n\'"
could not be validated.')



Since `n` is not in my request, I assumed it is incorrectly handling
`new`, or that I did not define it correctly.

This brought me to some inconsistencies in the manual. On one hand,
the definition is using a tuple, rather than a list, ex:
`application = Unicode(values=('usermgr', 'accountmgr'))`

This is a reference:
https://github.com/arskom/spyne/blob/master/examples/user_manager/server_basic.py#L57

On the other hand, the constraints are given as a list:






#RequestStatus = Enum('new', 'procesed', type_name='RequestStatus')


More information about the people mailing list