61 Commits

Author SHA1 Message Date
Jenkins
f9ecdd10d3 Merge "Pecan: Make it possible to use the Response to return a non-default return type" 2015-04-20 10:47:30 +00:00
Stéphane Bisinger
c4d39865d4 Converts prints to logging.debug calls
Some print calls were polluting the standard output with debugging
information. These prints are now converted to logging.debug calls
so that they are disabled by default.

Closes-Bug: #1426439
Change-Id: I42f3ca62b55a980839cc0cb481f33fea3cd22afe
2015-04-16 08:56:13 +02:00
Lucas Alvares Gomes
de877d2cc8 Pecan: Make it possible to use the Response to return a non-default return type
This patch is extending the Response object and the Pecan extension
to make it possible to return a non-default return type (just like it
already supports retuning a non default status code).

This is useful when the return code of a function is 204 (No Response) for
that case we automatically set the return_type to be None and guarantee
that the response body is empty and the content-lentgh is 0. Which if
not done can cause tools consuming the API to misbehave.

Change-Id: I629c3e2d5dc169154e5af044f1b8f804e4b87e23
2015-04-01 14:44:46 +01:00
Chris Dent
8710dabb65 Improve Accept and Content-Type handling
Originally, if WSME received an Accept or Content-Type header that
was not aligned with what it was prepared to handle it would error
out with a 500 status code. This is not good behavior for a web
service.

In the process of trying to fix this it was discovered that the
content-negotiation code within WSME (the code that, in part,
looks for a suitable protocol handler for a request) and tests of
that code are incorrect, violating expected HTTP behaviors. GET
requests are passing Content-Type headers to declare the desired
type of representation in the response. This is what Accept is for.

Unfortunately the server-side code was perfectly willing to accept
this behavior. These changes correct that.

Closes-Bug: 1419110
Change-Id: I2b5c0075611490c047b27b1b43b0505fc5534b3b
2015-02-18 14:11:35 +00:00
Chris Dent
bad1c3edfb Fix pep8 w503 errors
W503 doesn't allow binary ops at start of line, so this fixes
it.

Change-Id: I945950f8cb457414fe7d7b4638e99412275b3a06
2015-02-18 14:09:59 +00:00
Chris Dent
da67a34cc7 Correct pep8 errors from imports in weird places.
If there are side effects associated with the location of these
imports, the tests don't cover it, so we can only hope.

Change-Id: I86e9754ff96ed881515fb0c8f9997acff740471d
2015-02-09 15:19:02 +00:00
Sławek Ehlert
b4ef065a4c several fixes for SOAP protocol
* fixed a small issue with binding
* fix for python2.6 when iterating over input msg
  (if the processed element is a comment - skip it)
* import print function (because it is used
  here in this form)
* fix minOccurs for non mandatory arguments
* operation namespace fix

    - https://bugs.launchpad.net/wsme/+bug/1235238
    - https://groups.google.com/forum/#!topic/python-wsme/gVzogTZlC7w

Change-Id: I2d237e04f27f8acd912cc8e2eb27d12ff72ebd04
2015-01-05 10:33:01 +01:00
Christophe de Vienne
292c556808 Make the flask adapter working with flask.ext.restful
Change-Id: I71d875f6579799b2881f76859fa88226dfea9b2b
2014-11-11 09:45:09 +01:00
Ryan Petrello
26a6acdadd Add support for manually specifying supported content types in @wsmeexpose.
Closes-bug: #1271317
Change-Id: Ia28a912f4444a6ff77b1feaf2ea6440b0c738e86
2014-09-24 21:04:52 -04:00
Dustin J. Mitchell
2e1863db6c Use APIPATH_MAXLEN from the right module
This fixes an AttributeError.

Change-Id: Ic76f42d7fbd6c0dd0fbdf2ccf464e8fff80b11cd
2014-06-20 17:13:58 -04:00
Julien Danjou
8e6077e270 Fix pep8 errors
The recent pep8 upgrade is triggering new errors.

Change-Id: I73b1de3afed0a6979e0542e4c90cdb0bdb8b1122
2014-04-25 14:57:05 +02:00
Julien Danjou
d69a287ba4 pecan: cleanup, use global vars and staticmethod
Change-Id: If5a7c1b4b71380053ed650ddc8e9928422869807
2014-01-10 14:17:33 +01:00
Jenkins
3b52161a60 Merge "Enable and fix Sphinx tests" 2013-10-11 15:50:16 +00:00
Yuriy Zveryanskyy
9546c10250 Add custom error code to ClientSideError
Added custom error status code for ClientSideError
exception instead of hardcoded value 400.
Fixed case when user exception with client error code
formatted as server error.
Pecan extension fixed.

Change-Id: I2663db0aa88538b722eb2783d130585b0fc2335b
2013-10-09 16:59:40 +03:00
Julien Danjou
71c8bcf5d0 Enable and fix Sphinx tests
This remove the Sphinx environment and makes sure we run its test for
all Python version. This therefore fixes the test for Python 3.3.

Change-Id: Iba431e837d2b23761905155ff65ae909774ce0b2
2013-10-07 14:53:08 +02:00
Mehdi Abaakouk
664c214dbf Handle [] {} for body in rest protocols
This change allow to use [] or {} for the definition of the body in rest
protocols.

Fixes bug #1233219

Change-Id: Ib96f0487dd7d78bd657f6d4b3facbd8b611f8702
2013-10-04 15:55:39 +02:00
Julien Danjou
abcdd7affa Include Pecan tests in default Python environment
- Makes sure we always run Pecan test and that there's no regression.
  There's no real need to split them out as they are not invasive.
  Also that reduces the number of environment a bit.
- This also fixes Pecan tests on python2.6
- This also fixes Pecan tests on python3.3
- This also enables Pecan tests on python3.2

Change-Id: I57070b0bd785fb3d445f432973f15825abccbdd5
2013-09-26 17:37:03 +02:00
Jenkins
4fd56a3f1a Merge "Minor code cleanups" 2013-09-23 10:01:56 +00:00
Jenkins
dae6299157 Merge "Remove various usage of sys.exc_info()" 2013-09-22 14:31:54 +00:00
Julien Danjou
1c37ea475e Remove various usage of sys.exc_info()
Change-Id: I7454264b82e808c68dd182e7ce43db756651a00b
2013-09-18 16:52:03 +02:00
Julien Danjou
a04748e868 Minor code cleanups
Change-Id: I338656e8f131b36aae342af94f1c2cedad14ae2b
2013-09-18 11:30:18 +02:00
Ryan Petrello
62725bb773 Add improved support for HTTP response codes in cornice apps.
Change-Id: I35efe85794e761877edd06722952292a3cac5d85
2013-09-16 12:07:55 -04:00
Ryan Petrello
0aba00b1ef Add improved support for HTTP response codes in TG 1.x apps.
Change-Id: I829ab360e13ae88a47e810079c739eac1d925139
2013-09-06 15:06:35 -04:00
Ryan Petrello
d8a70a300e Add improved support for HTTP response codes in flask apps.
Change-Id: If9894b262c58c597d7f7ae0cf6cb5de6783d364d
2013-09-06 12:59:31 -04:00
Ryan Petrello
f91767bf1e pep8 fixes, including a declaration in tox.ini for running flake8
Change-Id: I2adc6a5cbd76edd16e6079046b67b8fc10bf1671
2013-09-05 11:15:27 -04:00
119Vik
651ad18bdd Fix for returned status code and .gitignore
For this purposes I added addiitional processing of original
exceptions at wsme/wsmeext/pecan.py. For exception's validation
special validator was added to wsme/wsmeext/utils.py. Also
functionality was reworked to be compatible with python3.3

Fixes bug#1214073
Change-Id: Ib1cd0b274bda11f62298848ebcd55b3f6641757c
2013-08-28 18:03:30 +03:00
Christophe de Vienne
f9fe028eff Fix issue #11 in the pecan adapter 2013-08-02 14:04:43 +02:00
Christophe de Vienne
579772807e The Response object can now carry error details. Not sure about this though, it needs refinements 2013-06-21 00:22:23 +02:00
Christophe de Vienne
82d97971fc Fix inner null objects in the extdirect protocol 2013-05-13 18:57:54 +02:00
Christophe de Vienne
d05fb583eb Fix returning objects with object attributes set to 'None' 2013-05-13 18:14:11 +02:00
Christophe de Vienne
cab152874c Use assertEquals so we see what is the wrong value if any 2013-05-04 18:25:29 +02:00
Angus Salkeld
6ff590844e pecan: Make it possible to use the Response to return non-default status codes.
This is copied from the flask extension.
2013-04-24 13:48:28 +10:00
Christophe de Vienne
6b1a94b092 wsmeext.cornice now handle errors properly 2013-04-17 17:51:44 +02:00
Christophe de Vienne
814e87ea72 wsmeext.cornice.signature can now decorate resource class methods 2013-04-17 16:03:56 +02:00
Christophe de Vienne
cffcee226c Pecan adapter: Debug mode (which returns the exception tracebacks to the
client) can be enabled by the pecan application configuration.
2013-04-16 15:42:23 +02:00
Christophe de Vienne
c1c8e709ad The cornice adapter now handle the url matched parameters 2013-04-10 11:41:52 +02:00
Christophe de Vienne
b2e760894e Move the missing argument verification in a wsme.runtime module so that it can be used in all adapters 2013-04-08 15:45:08 +02:00
Christophe de Vienne
d78a48c7ba Move the function documentation code to a separate function. 2013-04-04 21:50:20 +02:00
Christophe de Vienne
83bc4b596b A new HostRequest type can be used to have the host framework request object passed to the exposed functions 2013-04-02 16:19:30 +02:00
Christophe de Vienne
c1f08c40db Create some (incomplete) tests for the cornice adapter and fix it 2013-03-28 23:30:06 +01:00
Endre Karlson
6f9bb4d14f Add tests and fix check ordering in flask.py 2013-03-28 12:44:52 +00:00
Endre Karlson
dfc7f874b3 Fix typo 2013-03-28 12:26:40 +00:00
Endre Karlson
0222cbab00 Re-iterate status_code code 2013-03-28 12:23:32 +00:00
Endre Karlson
f2668824b3 Fixup support for content types in other places then Headers. 2013-03-27 00:31:15 +00:00
Endre Karlson
3944c29c96 Support override of response format via request.dataformat 2013-03-27 00:13:16 +00:00
Endre Karlson
2a1e50e6ef Add support for passing status_code or getting it from request 2013-03-26 23:35:27 +00:00
Christophe de Vienne
59a3123cde Fix the way the TG adapter calls wsme.rest.args.get_args 2013-03-26 15:08:20 +01:00
Christophe de Vienne
0fa0177eef Fix the way the pecan adapter calls wsme.rest.args.get_args 2013-03-26 14:55:12 +01:00
Christophe de Vienne
bfd1bfb4ff Various fixes for the flask adapter 2013-03-26 14:29:18 +01:00
Christophe de Vienne
78c3328506 Test & fix Server-side errors 2013-03-25 16:07:02 +01:00