Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
On Tue, Jun 2, 2015 at 4:32 AM, Chenhong Liu liuchenh...@unitedstack.com wrote: There is keystone/exception.py which contains Exceptions defined and used inside keystone provide 4xx and 5xx status code. And we can use it like: exception.Forbidden.code, exception.forbiddent.title exception.NotFound.code, exception.NotFound.title This makes the code looks pretty and avoid error prone. But I can't find definition for other status code, like 200, 201, 204, 302, and so on. The code in keystone, especially the unit test cases, just write these status code and title explicitly. How about add those definitions? Looks like Python 3.5 added constants in http.HTTPStatus[1]. So someday we'll be able to use those instead. [1] https://docs.python.org/3.5/library/http.html#http.HTTPStatus Sincerely, Brant __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
On Thu, Jun 4, 2015 at 4:43 AM Brant Knudson b...@acm.org wrote: On Tue, Jun 2, 2015 at 4:32 AM, Chenhong Liu liuchenh...@unitedstack.com wrote: There is keystone/exception.py which contains Exceptions defined and used inside keystone provide 4xx and 5xx status code. And we can use it like: exception.Forbidden.code, exception.forbiddent.title exception.NotFound.code, exception.NotFound.title This makes the code looks pretty and avoid error prone. But I can't find definition for other status code, like 200, 201, 204, 302, and so on. The code in keystone, especially the unit test cases, just write these status code and title explicitly. How about add those definitions? Looks like Python 3.5 added constants in http.HTTPStatus[1]. So someday we'll be able to use those instead. [1] https://docs.python.org/3.5/library/http.html#http.HTTPStatus Sincerely, Brant This will be a good choice. __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
On Tuesday 02 June 2015 09:32:45 Chenhong Liu wrote: There is keystone/exception.py which contains Exceptions defined and used inside keystone provide 4xx and 5xx status code. And we can use it like: exception.Forbidden.code, exception.forbiddent.title exception.NotFound.code, exception.NotFound.title This makes the code looks pretty and avoid error prone. But I can't find definition for other status code, like 200, 201, 204, 302, and so on. The code in keystone, especially the unit test cases, just write these status code and title explicitly. How about add those definitions? These are standard HTTP codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Description in exceptions is given because one error code can be used for several errors. Success codes always have one meaning. -- Best regards, Boris Bobrov __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
There is keystone/exception.py which contains Exceptions defined and used inside keystone provide 4xx and 5xx status code. And we can use it like: exception.Forbidden.code, exception.forbiddent.title exception.NotFound.code, exception.NotFound.title This makes the code looks pretty and avoid error prone. But I can't find definition for other status code, like 200, 201, 204, 302, and so on. The code in keystone, especially the unit test cases, just write these status code and title explicitly. How about add those definitions? __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
On Tue, Jun 2, 2015 at 5:46 PM Boris Bobrov bbob...@mirantis.com wrote: On Tuesday 02 June 2015 09:32:45 Chenhong Liu wrote: There is keystone/exception.py which contains Exceptions defined and used inside keystone provide 4xx and 5xx status code. And we can use it like: exception.Forbidden.code, exception.forbiddent.title exception.NotFound.code, exception.NotFound.title This makes the code looks pretty and avoid error prone. But I can't find definition for other status code, like 200, 201, 204, 302, and so on. The code in keystone, especially the unit test cases, just write these status code and title explicitly. How about add those definitions? These are standard HTTP codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Description in exceptions is given because one error code can be used for several errors. Success codes always have one meaning. I know HTTP codes. I mean writing something like module.OK or module.NoConent is better than writting '200 OK' or '204 No Conent'. -- Best regards, Boris Bobrov __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
Hi Chenhong Liu, encapsulated into the WSGI application, Keystone is architecturally organized as follows: Application - Router - Controller - Manager - Driver The Router connects called URLs with the code in the Controller, which delegates actions to Manager, which manages the business logic and in turn calls the configured Driver to access stored information. The Controller level may catch raised exceptions from Manager/Driver [1]; those are the exceptions defined at exception.py and represent the 4xx and 5xx HTTP status codes. When a Controller call to Manager/Driver has success, it may set the HTTP status code itself [2] or it will be defined when rendering the WSGI response [3]; those are the 2xx HTTP status codes. The 300 HTTP status code is particularly used in version discovery, and is defined at that specific manager call in the base Controller class [4]. Sincerely, Samuel [1] http://git.openstack.org/cgit/openstack/keystone/tree/keystone/identity/backends/sql.py#n130 [2] http://git.openstack.org/cgit/openstack/keystone/tree/keystone/contrib/federation/controllers.py#n100 [3] http://git.openstack.org/cgit/openstack/keystone/tree/keystone/common/wsgi.py#n740 [4] http://git.openstack.org/cgit/openstack/keystone/tree/keystone/controllers.py#n178 Em 02.06.2015 06:45, Boris Bobrov escreveu: On Tuesday 02 June 2015 09:32:45 Chenhong Liu wrote: There is keystone/exception.py which contains Exceptions defined and used inside keystone provide 4xx and 5xx status code. And we can use it like: exception.Forbidden.code, exception.forbiddent.title exception.NotFound.code, exception.NotFound.title This makes the code looks pretty and avoid error prone. But I can't find definition for other status code, like 200, 201, 204, 302, and so on. The code in keystone, especially the unit test cases, just write these status code and title explicitly. How about add those definitions? These are standard HTTP codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Description in exceptions is given because one error code can be used for several errors. Success codes always have one meaning. __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
On Tue, Jun 2, 2015 at 7:24 PM samuel sam...@lsd.ufcg.edu.br wrote: Hi Chenhong Liu, In addition, I think creating a common file to place non-error HTTP status code is a good idea and can be discussed with the Keystone cores. Feel free to add a point to our weekly meeting, Tuesdays 18:00 UTC. [1] Thanks, samuel. I will be online tonight. Sincerely, Samuel [1] https://wiki.openstack.org/wiki/Meetings/KeystoneMeeting __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
Hi Chenhong Liu, In addition, I think creating a common file to place non-error HTTP status code is a good idea and can be discussed with the Keystone cores. Feel free to add a point to our weekly meeting, Tuesdays 18:00 UTC. [1] Sincerely, Samuel [1] https://wiki.openstack.org/wiki/Meetings/KeystoneMeeting __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [keystone]Why not common definition about normal HTTP status code like 2xx and 3xx?
On 6/2/15, 04:45, Boris Bobrov bbob...@mirantis.com wrote: On Tuesday 02 June 2015 09:32:45 Chenhong Liu wrote: There is keystone/exception.py which contains Exceptions defined and used inside keystone provide 4xx and 5xx status code. And we can use it like: exception.Forbidden.code, exception.forbiddent.title exception.NotFound.code, exception.NotFound.title This makes the code looks pretty and avoid error prone. But I can't find definition for other status code, like 200, 201, 204, 302, and so on. The code in keystone, especially the unit test cases, just write these status code and title explicitly. How about add those definitions? These are standard HTTP codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Description in exceptions is given because one error code can be used for several errors. Success codes always have one meaning. 2616 is dead. Please reference 723[0-5] from now on. https://tools.ietf.org/html/rfc7231#section-6 __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev