Sphinx is currently issuing the following warnings for projects using
this extension.
RemovedInSphinx30Warning: sphinx.locale.l_() is deprecated. Please
use `_()` instead.
Head this off before it becomes an issue.
Change-Id: I108d36ab909a7afd4fd28bfb565812f69ae02118
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Use absolute imports to ensure we import the standard library 'json'
module and not our module that shadows it.
Change-Id: I7b55aad974a0145934069f14c91ce03e41bccef3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This was allegedly included back when simplejson was more performant
that the 'json' library in Python's library. It's additional complexity
that we simple don't need. Remove it. This also allows us to clean up
the tox file significantly.
Note that we must also rename the 'json' module to 'json_utils', as this
was shadowing a built-in library. This is a latent issue that was
highlighted by removing of 'simplejson' imports.
Change-Id: Id9faa9859993e598e2fd08133de576b740790bf3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This also allows us to removal lxml as an optional dependency.
Change-Id: I7ce0418012070677e36e41236487f3fabc0763a8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
I didn't even know this was a thing. Needless to say, we can safely
remove this now.
Change-Id: I92c9c0fe99af61c438ab92a61bd8dd8bb192054b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
As with turbogears, no one was using this in OpenStack and therefore we
can and should remove this adaptor.
Change-Id: I0d3942680c1156e57d70f334caea6b89590b46c7
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
No one in OpenStack that's still using this is using turbogears. Kill
it.
Change-Id: Ifeff1f40834289093dd997ce34fc3b42c3abbc13
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
It appears that in newer sphinx versions the index of :module:
directive in the resulting documenter object array has changed,
it is not the last element anymore. Apart from that, it is
possible to have several :module: entries in class for example.
This change fixes the issue for service, function and type
wsme documenters.
Change-Id: Icf44f8af0c1e6e70d8e921615efe03b845885be7
Somewhere along the way, WSME and flask/werkzeug have got out of sync
and tests have started failing. Since there aren't regular contributions
to WSME we don't catch these changes, so this may have happened months
or years ago.
I have adjusted tests to attempt to account for what I can, but one test
fails to work so I have marked it as an xfail. It works correctly with
werkzeug 1.13.x but not later. Since WSME is in something worse than
maintenance mode, I'm not inclined to fix this.
pep8/flake8 in python3 is more strict than python. The gate now
runs the pep8 jobs using python3 by default, so the local jobs
should as well. This changes the job and also fixes the new problems it
points out.
There are other failures, but they are present in master as well, so
leaving that for other changes.
Change-Id: I57ae0405e0d6ddba0bb1dac93020fb08a0fc7c89
This patch is fixing the WSME Sphinx extension to work with Python 3.
The patch just checks the return value from the find_service_path()
method before it tries to do anything with it.
Change-Id: I5a4cfa42a8768ce35a1c1a999431e842c7dde020
Closes-Bug: #1657435
This change also adds cornice-py3 environment to tox-tmpl.ini,
as previously it was added manually directly in tox.ini.
Change-Id: I6c0924ca4cc7a42b57af01312da21b94ed1efa85
Unit tests were still using the deprecated assertEquals instead of
assertEqual. This removes all mentions of assertEquals to use the new name and
be compatible with the OpenStack Style Guidelines.
Closes-Bug: #1454766
Partial-Bug: #1446692
Change-Id: Ieb90a334a0d0e91845d20a3e4ea4697307ed3f2a
Add some tests to verify that UserType objects are correctly converted
to the specified basetype. Bug #1228040 was based on a wrong usage of
the UserType base class, so these also stand as a further example of
correct usage.
Related-Bug: #1228040
Change-Id: I7d50164930c2ae7abeddcade4f876eef5b273b6b
If on a service exposed with some arguments with a built-in type among
int, long, bool or float a request is made passing a JSON with string
values instead of the intended type, the called function would have
strings as parameters instead of the expected types. This also means
that invalid strings would still be passed without error, leading to
unexpected failures. This patch tries to convert the string to the
intended type before failing with an InvalidInput exception if the
string can't be converted. This is to try and be as nice as possible
with whatever input is thrown at wsme.
Closes-Bug: 1450544
Change-Id: I705c183bb68457d539074b78ce81339b9464e1e0
The gate 34 tests were not running any tests because there was no
tox target. This changes tox-tmpl.ini (and the resulting tox.ini) to
add support for python 34 and remove support for anything that is
not py34 or py27-based.
To make the python3 tox environments work, the remote zip of a suds
fork has been replaced with suds-jurko, a relatively modern fork of
the original suds that supports python2 and 3.
Some tests needed to be fixed to deal with two main problems:
* reponse bodies being bytes
* Exceptions not having a .message attribute (.args[0] is used
instead)
* the test_flask tests were not being run for python3, they are now
* wsmeext/sphinxext.py intermittently fails due to the dictionary
changing size in flight, getting the keys prior to iteration fixes
it
Both 27 and 34 should be running 420 tests as of this commit.
Change-Id: I837c249714fd957790ea84aa2fd9ad994a39c5ea
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
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
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
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
* 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
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
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
This change allow to use [] or {} for the definition of the body in rest
protocols.
Fixes bug #1233219
Change-Id: Ib96f0487dd7d78bd657f6d4b3facbd8b611f8702
- 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
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