Commit Graph

735 Commits

Author SHA1 Message Date
Tony Breeds 30a526a8b3 Retire Packaging Deb project repos
This commit is part of a series to retire the Packaging Deb
project. Step 2 is to remove all content from the project
repos, replacing it with a README notification where to find
ongoing work, and how to recover the repo if needed at some
future point (as in
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project).

Change-Id: Ib3976cdfab839242694ce603451ef38407650721
2017-09-12 16:13:46 -06:00
Sanu Madhavan 9f84e4c7c5 Remove white space between print ()
There was a white space between print and ()

Change-Id: I6793e52c441728e991fe61afb73227e16368d758
2017-01-20 15:38:05 +05:30
Lucas Alvares Gomes 7e96104e7b Fix: Sphinx extension on Python3
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
2017-01-18 12:08:57 +00:00
Lucas Alvares Gomes 9676ffcd1d Fix the setup.cfg metadata
This patch is removing the quotes from "author" and "author-email"
metadata in the setup.cfg file. Apparently having the values quoted
causes the openstack-infra/project-config release.sh script to error out
when uploading it to Pypi.

This patch also updates the "url" metadata to point to the openstack git
server.

Change-Id: I992a5053a48f7a49f08f299b170cc3da40de242b
2017-01-04 14:43:55 +00:00
Vladyslav Drok 1670793bfe Print exceptions raised from from_param methods
This makes debugging the problems easier.

Change-Id: I285d8176b8cfb0cdf1e9cecd8ae5a0a7f0f109e7
2016-12-23 14:09:16 +02:00
Vladyslav Drok ecaf3aa40f Fix pep8 issues and switch to py35 in tox.ini
This change also adds cornice-py3 environment to tox-tmpl.ini,
as previously it was added manually directly in tox.ini.

Change-Id: I6c0924ca4cc7a42b57af01312da21b94ed1efa85
2016-12-23 14:02:33 +02:00
Christophe de Vienne 42e1239e9d [doc] Complete doc requirements
Currently readthedocs is unable to build the documentation because not all the
dependencies gets installed.

This patch add the wsme requirements to the doc requirements, with the hope
it fixes the build on readthedocs.

Change-Id: Ib17d3e77ec1eb0d200a0c478663c7cbd2710aed3
2016-03-08 11:30:20 +00:00
Christophe de Vienne b749712221 Add the 0.8.0 changes list
Change-Id: Ib1c9daa74702134945fdda04b6e31c196154e37c
2016-03-08 11:29:03 +00:00
Jenkins f621576b9f Merge "Port test_cornice to Python 3" 2016-03-08 11:28:12 +00:00
Victor Stinner 4a57d81b4a wsattr.__set__() catchs TypeError
On Python 3, comparison between string (str) and integer (int) raises
a TypeError exception. I suggest to catch it to raise an InvalidInput
exception, as we already do for ValueError.

In practice, the TypeError was seen in OpenStack Cue tests on
Python 3, in a test passing a string to an attribute expecting an
integer, attribute having a minimum set (to an integer too).

Change-Id: I74103330ccb5cdc26aa3508fcefcc34310e00c27
2016-03-08 11:21:06 +01:00
houming-wang 30bb63a6f5 Fix jenkins failure
Fix the failed test case

Traceback (most recent call last):
  File "/opt/stack/wsme/wsme/tests/test_utils.py", line 78, in
test_parse_isodatetime
    self.assertRaises(ValueError, utils.parse_isodatetime, s)
AssertionError: ValueError not raised

Change-Id: I6c36f8b0340cd7b4c6f35e7c7c5886598e2c5f0c
Closes-Bug: #1532734
2016-03-08 09:40:15 +00:00
Victor Stinner 6560133d79 Port test_cornice to Python 3
* Use byte strings for HTTP body
* Remove debug print()
* tox.ini: add cornice-py3 test environment

Note: It looks like it doesn't work to inherit commands from cornice
into cornice-py3 because cornice commands use the substitution string
{posargs}.

Change-Id: Iaed39babc7ee9877d443c47c2f4b21b2e98b5181
2016-03-08 10:31:21 +01:00
venkatamahesh 5376fe2f0e Change the repositories from stackforge to openstack
Change-Id: Ia3fced3c026fe6f8a039a584b99f8d44f8a8b3f4
2015-10-19 14:51:33 +05:30
Jeremy Stanley 37aad0e15d Update .gitreview for new namespace
Change-Id: I2164db3323c1c1330c977652c46a2f18c49fa76e
2015-10-17 22:41:53 +00:00
Mehdi Abaakouk 1dc4421b4f Return 400, if the query string is not a dict
When we parse the json object that come in query string,
we expect to find a dict, but not bail out if that not the case.
So this will raise a 500.

This changes this and return 400, because the input is invalid.

Change-Id: I1a3b927cdfb3b554026306d65a46ed91635d073c
Closes-bug: #1423634
2015-08-07 12:47:18 +02:00
Jenkins 7784cc73b1 Merge "rest: return 415 when content-type is invalid" 2015-08-07 09:28:25 +00:00
Jenkins 52f756a9de Merge "Complex types should check unexpected attributes" 2015-08-07 09:28:13 +00:00
Mehdi Abaakouk 078cd72365 rest: return 415 when content-type is invalid
When the body of a POST request cannot be decoded because
the content-type is not supported by any rest controller.

The server should return 415, not 500.

Related bug: #1419110

Change-Id: I8f8df4ab4062181e8d511e437a8486182c262ff8
2015-08-04 08:45:58 +02:00
Mehdi Abaakouk 03f0c0b4d6 json: raise ValueError invalid list or dict
If the expected datatype is ArrayType or DictType
but the json value is something else raise
ValueError instead of 500 erro because we can browse the
dict or the list.

Closes bug: #1428628

Change-Id: Ibd4d95815c0b81ded8304bba4ca83e6df32d86ae
2015-08-03 16:06:09 +02:00
Mehdi Abaakouk 2cb266eadb Fixes exception path with the datatype is a Object
If the object type is ArrayType or DictType, the datatype
is an object not a class. Currently a 500 error is raise
just because the exception path for invalid input handle only
when the datatype is an UserType or Class, not object.

This change fixes that.

Change-Id: Ifadef698a4dca0d33167bd4d5a567c43fe015108
Closes-bug: #1428185
2015-08-03 16:06:09 +02:00
Jenkins 1526b4ce62 Merge "Update README formatting for release tools" 2015-07-22 15:14:29 +00:00
Doug Hellmann 1fef3f2714 Update README formatting for release tools
Update the README file to list links in a format expected by the
OpenStack release tools so we can generate release announcement emails
automatically.

Change-Id: I84865bc1787ad980c65e49f7b6ae40c66d92b4e7
2015-06-01 16:44:34 +00:00
Doug Hellmann e6d471be88 Set up dependencies for cross-tests
Set up the venv environment to let us use it for pre-release cross
testing to ensure we don't break consuming project unit tests.

Change-Id: If2bee203cb120b6c3b17a863fca2ece12651024f
2015-06-01 13:53:09 +00:00
Jenkins 43e125ded9 Merge "Move ipaddr to netaddr" 2015-05-29 13:04:49 +00:00
Stéphane Bisinger 9b3e71e2ac Add instructions to configure cornice with WSME
Add an example in the documentation to show how to configure pyramid to
use the WSME extensions with cornice.

Closes-Bug: #1316888
Change-Id: Id1ad7149260205809de0b7f8ded51d45a8390880
2015-05-28 12:52:26 +02:00
Lan Qi song 002473c0ea Move ipaddr to netaddr
Ipaddr module was never introduced by openstack and never used by
other openstack components. We should move to more reliable module
netaddr to validate ip format.

Change-Id: I38d0c6f4ea2147ce071ab62a7c9d546436aec185
Closes-Bug: #1455404
2015-05-27 23:20:40 +08:00
Ryan Petrello d60de97edc Add pytz as a dependency.
pytz was used in https://review.openstack.org/#/c/161013 but is not a WSME
dependency.  This causes pecan test, which gates against WSME, to fail.

Change-Id: I71e60648a08f019c0da355ba2d25ea05d6fcdf2f
2015-05-27 09:51:31 -04:00
Jenkins 0f2516ef1c Merge "Added timezone support to parse_isodatetime" 2015-05-26 20:45:23 +00:00
Stéphane Bisinger a88c83001f Fix wrong reference to status argument in the docs
Fix the documentation where it sais that wsme.signature takes a status
argument: the actual name of the argument is status_code.

Closes-Bug: #1455563
Change-Id: Ifa3abef5654e5b796285a467fe5e6bce248ef60c
2015-05-26 17:29:45 +00:00
Michael Krotscheck 3ea152cab0 Added timezone support to parse_isodatetime
Timezones are added to datetime() and time() instances
using pytz's FixedOffset.

Change-Id: I2484c5cd924348305e681dc2902bafd19c75eb6e
2015-05-22 09:36:39 -07:00
Stéphane Bisinger 6461c1b8a1 Complex types should check unexpected attributes
Check if a request is passing more attributes for complex objects than
those defined in the API. WSME did not care if some unknown attribute
was passed to an API with a complex type, only checking the required
attributes. This is fixed raising a ValueError if more attributes are
given than expected, resulting in an HTTP response with a 400 status.
This helps check the validity of requests, which would otherwise
unexpectedly work with (partially) invalid data.

Closes-Bug: #1277571
Change-Id: Idf720a1c3fac8bdc8dca21a1ccdb126110dae62e
2015-05-18 12:39:50 +02:00
Jenkins f28ec1354e Merge "Replace deprecated assertEquals with assertEqual" 2015-05-14 14:24:51 +00:00
Stéphane Bisinger 32456d3e47 Replace deprecated assertEquals with assertEqual
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
2015-05-13 18:35:41 +02:00
Chris Dent 7379a3a88e Update changes doc
Prepare for a 0.7.0 release.

Change-Id: Ic4cb1e540ea1087cc0d3c12a76dfe00939e481c2
2015-05-13 12:32:46 +00:00
Stéphane Bisinger d2f8f8fb1c Ensure UserType objects are converted to basetype
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
2015-05-07 17:05:09 +02:00
Stéphane Bisinger 9a0d3c1461 Convert built-in types when passed as strings
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
2015-05-06 23:04:18 +02:00
Jenkins eb37037f54 Merge "Remove tab character from setup.cfg" 2015-04-29 11:16:43 +00:00
Chris Dent 78d6b89d18 Enable real testing of python 3.4
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
2015-04-28 14:59:33 +01:00
Jenkins c46e2b102e Merge "Remove unsupported python versions from setup.cfg" 2015-04-28 10:15:26 +00:00
Chris Dent e31045e57a Multiple protocol accept or content-type matching
The changes in 8710dabb65 broke
protocol failover when the REST protocol is listed before others
(see bug referenced below).

This patch tries to solve both issues by trying to match accept over all
the protocols, only giving up a 406 or 415 if all protocols fail, using
the last failure as the error message.

Related-Bug: #1419110
Closes-Bug: #1442710
Change-Id: I328a392151013c46207519c245213d5dec48ecc9
2015-04-24 16:19:46 +02:00
Stéphane Bisinger f66cf4c3cc Raise an InvalidInput if you get a ValueError from JSON data.
When you parse JSON, if some parts of the message have the wrong type of data
you would get a ValueError, returning a 500 HTTP status code. Now the
ValueError gets wrapped in an InvalidInput which will result in a 400 HTTP
response sent back to the client.

Closes-Bug: #1392409
Change-Id: I7702b824a98185d194a29d593b23e47dfd9bca3e
2015-04-24 00:56:04 +02:00
Stéphane Bisinger 8d9f82d7fe Return a 400 status code on invalid JSON input
Instead of returning a 500 HTTP status code, return a 400 status code when the
received input is invalid JSON.
Also add a unit test for this case.

Closes-Bug: #1428462
Change-Id: Id02de0a7b8fcbcb07f7ac534519dcdc1cbb04839
2015-04-23 17:09:44 +02:00
Louis Taylor b4e918bdfe Remove unsupported python versions from setup.cfg
Openstack doesn't support these versions, so we probably shouldn't have
to.

Change-Id: Ica6a221c7b1488f9b25e3027a265df9258951764
Closes-Bug: #1447048
2015-04-22 17:46:25 +01:00
Louis Taylor 34f325a166 Clean up setup.py and add requirements.txt
Previously setup.py had information about which versions of libraries to depend
on based on the python version. Since we don't need to support those versions
anymore (2.5, 2.6 and 3.3), these dependancies can be listed in a
requirements.txt file.  This can be set up to sync with global-requirements at
a later date.

ipaddr is added to requirements-py2.txt, since it is only needed on python
version lower than 3.3.

Change-Id: I90c4cbd7961ffdf6769578986c272bf9f5721d77
2015-04-21 23:42:59 +01:00
Louis Taylor 5874aa6b17 Remove tab character from setup.cfg
This annoyed me more than it should.

Change-Id: Ia8690d585c991ee14dc87de1d91ac931be0551ce
2015-04-21 21:03:14 +01:00
Jenkins 44d514886b Merge "Add full MIT license" 2015-04-21 17:46:51 +00:00
Louis Taylor f6602e7272 Add full MIT license
Change-Id: I3c391410ea820cb8e721bb8a26800792485ed507
2015-04-21 16:10:25 +01:00
Lucas Alvares Gomes 81afe37c0e Fix i18n when formatting exception
This patch is also adding the missing tests to the format_exception()
function since it's related to the fix.

Change-Id: Id1ab32076e5d112493216dcd92f80fe6e0199237
Closes-Bug: #1437125
2015-04-20 16:09:00 +01:00
Jenkins a42d23d8ce Merge "Change client-side error logging to debug" 2015-04-20 13:38:03 +00:00
Jenkins ed4a5cc6bf Merge "Fix validation of IPv{4,6}AddressType" 2015-04-20 11:09:54 +00:00