[spyne] String constraints and enums

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


Attached is an example that replicates the problem, the code is also
available here: http://pastebin.com/L0UC6pzh


This is an example of what happens:
telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
POST / HTTP/1.1
Host: localhost
Content-Length: 42

{"DemoFunction":{"data":{"status":"new"}}}
HTTP/1.0 400 Bad Request
Date: Tue, 17 Jun 2014 12:46:01 GMT
Server: WSGIServer/0.1 Python/2.7.4
Content-Length: 131
Content-Type: application/json

{"faultcode": "Client.ValidationError", "faultstring": "The value
\"{u'status': u'new'}\" could not be validated.", "detail":
null}Connection closed by foreign host.





Here's the weird part, when I first ran it - it worked as expected. I
then gave it another try and the problem persists ever since.
Fortunately my terminal log confirms that it did behave correctly
once, printing `4` the first time:

alex at ralien ~/dk_cvs/Netopay/WebAPI/src $ telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
POST / HTTP/1.1
Host: localhost
Content-Length: 42

{"DemoFunction":{"data":{"status":"new"}}}
HTTP/1.0 200 OK
Date: Tue, 17 Jun 2014 12:34:46 GMT
Server: WSGIServer/0.1 Python/2.7.4
Content-Type: application/json

4Connection closed by foreign host.
alex at ralien ~/dk_cvs/Netopay/WebAPI/src $ telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
POST / HTTP/1.1
Host: localhost
Content-Length: 42

{"DemoFunction":{"data":{"status":"new"}}}
HTTP/1.0 400 Bad Request
Date: Tue, 17 Jun 2014 12:35:53 GMT
Server: WSGIServer/0.1 Python/2.7.4
Content-Length: 131
Content-Type: application/json

{"faultcode": "Client.ValidationError", "faultstring": "The value
\"{u'status': u'new'}\" could not be validated.", "detail":
null}Connection closed by foreign host.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UnicodeValuesTest.py
Type: text/x-python
Size: 1258 bytes
Desc: not available
URL: <http://lists.spyne.io/archives/people/attachments/20140617/0c999f2e/attachment.py>


More information about the people mailing list