Update docs for first release

Ensure each exported class has a docstring.

Add API to the sphinx docs.

Fix a few formatting issues so the rendered docs look OK.

Change-Id: Ieef7bae3783a084249169fe9b80ab17518eee15f
This commit is contained in:
Doug Hellmann 2014-08-26 10:18:51 -04:00
parent fc156ec069
commit b6c4489960
10 changed files with 31 additions and 36 deletions

View File

@ -14,4 +14,4 @@ Pull requests submitted through GitHub will be ignored.
Bugs should be filed on Launchpad, not GitHub: Bugs should be filed on Launchpad, not GitHub:
https://bugs.launchpad.net/oslo.middleware https://bugs.launchpad.net/oslo

6
doc/source/api.rst Normal file
View File

@ -0,0 +1,6 @@
=====
API
=====
.. automodule:: oslo.middleware
:members:

View File

@ -1 +1,5 @@
.. include:: ../../CONTRIBUTING.rst ==============
Contributing
==============
.. include:: ../../CONTRIBUTING.rst

View File

@ -1,19 +1,11 @@
Welcome to oslo.middleware's documentation! .. include:: ../../README.rst
===========================================
Contents: Contents
========
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
readme
installation installation
usage api
contributing contributing
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1 +0,0 @@
.. include:: ../README.rst

View File

@ -1,7 +0,0 @@
========
Usage
========
To use oslo.middleware in a project::
import oslo.middleware

View File

@ -13,11 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""Middleware that provides high-level error handling.
It catches all exceptions from subsequent applications in WSGI pipeline
to hide internal errors from API response.
"""
import logging import logging
import webob.dec import webob.dec
@ -31,6 +26,11 @@ LOG = logging.getLogger(__name__)
class CatchErrors(base.Middleware): class CatchErrors(base.Middleware):
"""Middleware that provides high-level error handling.
It catches all exceptions from subsequent applications in WSGI pipeline
to hide internal errors from API response.
"""
@webob.dec.wsgify @webob.dec.wsgify
def __call__(self, req): def __call__(self, req):

View File

@ -13,14 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""Middleware that attaches a correlation id to WSGI request"""
import uuid import uuid
from oslo.middleware import base from oslo.middleware import base
class CorrelationId(base.Middleware): class CorrelationId(base.Middleware):
"Middleware that attaches a correlation id to WSGI request"
def process_request(self, req): def process_request(self, req):
correlation_id = (req.headers.get("X_CORRELATION_ID") or correlation_id = (req.headers.get("X_CORRELATION_ID") or

View File

@ -13,12 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""Middleware that ensures request ID.
It ensures to assign request ID for each API request and set it to
request environment. The request ID is also added to API response.
"""
import webob.dec import webob.dec
from oslo.middleware import base from oslo.middleware import base
@ -30,6 +24,11 @@ HTTP_RESP_HEADER_REQUEST_ID = 'x-openstack-request-id'
class RequestId(base.Middleware): class RequestId(base.Middleware):
"""Middleware that ensures request ID.
It ensures to assign request ID for each API request and set it to
request environment. The request ID is also added to API response.
"""
@webob.dec.wsgify @webob.dec.wsgify
def __call__(self, req): def __call__(self, req):

View File

@ -45,4 +45,7 @@ input_file = oslo.middleware/locale/oslo.middleware.pot
[extract_messages] [extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg mapping_file = babel.cfg
output_file = oslo.middleware/locale/oslo.middleware.pot output_file = oslo.middleware/locale/oslo.middleware.pot
[pbr]
warnerrors = True