10 Commits

Author SHA1 Message Date
Victor Stinner
ee426f91d6 py3: Add json attribute to HTTP response objects
Add a json attribute to CreatedResponse and JSONResponse of
openstack_dashboard.api.rest.utils.

This patch changes unit tests: they now compare deserialized JSON
data instead of comparing the serialized JSON data which depends on
the exact hash function

This change makes the code more readable, but it was written to port
openstack_dashboard to Python 3. On Python 3, the hash function is
now randomized by default, so dictionary items are serialized in a
random order by JSON. Moreover, the hash function is different on
Python 2 and Python 3, so setting PYTHONHASHSEED=0 in tox.ini is not
enough to have a reliable JSON serialized ouput in all cases.

Fix also NaNJSONEncoder: On Python 3, don't try to decode bytes from
the encoder encoding, since the JSON encoder has no more encoding on
Python 3: it produces an Unicode string.

Partial-Implements: blueprint porting-python3
Change-Id: I8503ee530d4122b2ce733d02023454796934c8e6
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
2015-10-06 14:17:19 +02:00
Timur Sufiev
5398de264d Enable Launch Instance NG for the case when Nova quotas are disabled
Do this by representing every float('inf') python numeric as a 1e+999
JSON token - this way Javascript JSON.parse() correctly transforms it
to the Javascript Infinity object. The infinity value corresponds to
disabled limits.

The logic of representing infinity values as 1e+999 tokens is
implemented by means of custom `NaNJSONEncoder` which overrides
`iterencode` method of its `json.JSONEncoder` ancestor. Due to the
fact that the ancestor method could take an advantage of
`c_make_encoder` function (which is implemented in C) - and thus could
be much faster, I'm using the custom encoder only where it's really
needed, to not hamper Horizon performance.

Rewrite pie-chart directive rendering according to
https://invis.io/A4445BDSF

Change-Id: If498d9ccd5f0144c9e78ae58583ede2c1cf83f0b
Closes-Bug: #1482705
2015-09-18 17:55:59 +03:00
Doug Fish
3531d7bb9a Revert "Refactoring the exceptions lists"
This reverts commit 7fc1baad3a909465423810758a8d83c4715a1010.

Change-Id: I495e76eea8c873d71b37625b0953d821156c599c
Closes-Bug: 1440903
2015-04-06 16:49:17 -05:00
George Peristerakis
7fc1baad3a Refactoring the exceptions lists
The exception list is not properly used. The exception list is a
settings constant that can be modified within the settings file.  Having
the list in openstack_dashboard/exceptions.py confuses the
developers. The list of exceptions are moved in the settings file and
removed all duplications.

Partially Implements: blueprint improve-error-message-details-for-usability
Change-Id: I5e19c3f0b84b17fa28f6e3c113467cc19d9b0a03
2015-04-01 15:00:30 -04:00
Jenkins
30e014cf25 Merge "Rest API for Users list filter" 2015-03-06 01:15:32 +00:00
Mike Hagedorn
255340c596 REST API to support create instance angular (Neutron).
In this update:
- fixed tests
- fixed exception handling, params on ports
- fixed to_dict for a number of cases
- replaced use of request.DATA with request.GET for GET methods
- added handling of HTTP error raised with no status/code attr
- removed check for network_id in subnets as it's not required
- fix to_dict for Network with Subnets

Supercedes
https://review.openstack.org/#/c/152243
https://review.openstack.org/#/c/151313

Partially Implements: blueprint launch-instance-redesign
Co-Authored-By: Aaron Sahlin <asahlin@us.ibm.com>
Co-Authored-By: Michael Hagedorn <mike.hagedorn@hp.com>
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>

Change-Id: Ia40fde6d66720a03a531b516a6a53a2e86ec0d8f
2015-03-04 07:20:43 -05:00
Cindy Lu
2cca73ff5f Rest API for Users list filter
Add the filter functionality that Keystone supports.
Used by Randy's Magic Search patch:
https://review.openstack.org/#/c/151386/.

Also refactor out parse_filters_kwargs method which is used
by several rest api.

Co-Authored-By: Justin Pomeroy <jpomero@linux.vnet.ibm.com>

Change-Id: Ib65395eae345e1368fbb45f6b4ce3cbb9595d61b
Partially-Implements: blueprint filtered-client-side-table
2015-03-02 13:12:05 -08:00
Richard Jones
64f7bad172 Alter verb usage for keystone REST and add Angular service
This patch adds an Angular service to isolate client-side code from REST API
changes, and also changes the REST API to use PATCH instead of PUT as the
update verb. Except the one new PUT method for granting a role.

Multiple DELETE is removed from the overloaded POST actions, and the role
grant is moved to a PUT action.

The new angular API service implements error handling by default.

The request Python API JSON body test was made more sane. Thanks to all the
reviewers who brought that up, I finally saw the light!

Change-Id: Ifd58fbf4fac3c3f53dc4769fd76cddfa3101d9d2
2015-02-04 04:59:05 +00:00
Masco Kaliyamoorthy
193e66792f adopt namespace-less oslo imports
oslo.config is now deprecated, so switching
from oslo.config to right package oslo_config.

similarly oslo.serialization also deprecated, it
is also switched to oslo_serialization from
oslo.serialization.

Change-Id: I52eff48a17a555750379e4ca6bb024fc71a4efeb
Closes-Bug: #1409733
2015-01-21 12:15:07 +05:30
Richard Jones
cd735d44f3 REST API for angular front end.
This is the start of the API to support the angular front end.

It is missing endpoints not immediately used by angular WIPs other
than the identity re-work, but is enough to start with.

Changes:
- handle additional HTTP status code attribute
- move common helpers from test modules to here

Partially Implements: blueprint angularize-identity-tables

Change-Id: I7495f772be80125fdf52b02883a5b9942db34610
2015-01-13 13:41:49 +13:00