[spyne] String constraints and enums

Burak Arslan burak.arslan at arskom.com.tr
Tue Jun 17 15:15:27 UTC 2014


On 06/17/14 15:27, Alex wrote:
> 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:
> `SomeUnicode = Unicode(values=['x', 'y', 'z'])`
>


Any sequence will do. Using tuple or list or deque or whatever doesn't
matter.


> I tried them both and I got the same behaviour.  I then tried to use
> the Enum type, as such:
> `RequestStatus = Enum('new', 'procesed', type_name='RequestStatus')`
>
> And Spyne gave me the same error.


Don't use enum, it's just there for compatibility with certain soap clients.

> So, the questions are:
> 1. what is the difference between these notations (if they are both acceptable)
> 2. why is it not working? (incorrect use, or an issue in the implementation?)
>
>
>
>
>
> I've tried to debug it myself and what I find weird is this part in
> spyne/protocol/dictdoc.py, inside _doc_to_object:

The example you sent doesn't have anything to do with the code path
you're following here. Could you provide a working example for this case
as well?

Best,
Burak


More information about the people mailing list