Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Fix docs warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Nov 5, 2015
1 parent 600faa5 commit f54b010
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 45 deletions.
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -53,6 +53,7 @@ loadtest-check-simulation:
clean:
find . -name '*.pyc' -delete
find . -name '__pycache__' -type d | xargs rm -fr
rm -fr docs/_build/

distclean: clean
rm -fr *.egg *.egg-info/ dist/ build/
Expand All @@ -61,6 +62,6 @@ maintainer-clean: distclean
rm -fr .venv/ .tox/

docs: install-dev
$(VENV)/bin/sphinx-build -n -b html -d $(SPHINX_BUILDDIR)/doctrees cliquet_docs $(SPHINX_BUILDDIR)/html
$(VENV)/bin/sphinx-build -a -n -b html -d $(SPHINX_BUILDDIR)/doctrees cliquet_docs $(SPHINX_BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(SPHINX_BUILDDIR)/html/index.html"
2 changes: 1 addition & 1 deletion cliquet/resource/__init__.py
Expand Up @@ -129,7 +129,7 @@ class BaseResource(object):

default_model = Model
"""Default :class:`cliquet.resource.model.Model` class to use for
interacting the :module:`cliquet.storage` and :module:`cliquet.permission`
interacting the :mod:`cliquet.storage` and :mod:`cliquet.permission`
backends."""

mapping = ResourceSchema()
Expand Down
6 changes: 3 additions & 3 deletions cliquet/storage/memory.py
Expand Up @@ -146,7 +146,7 @@ def extract_record_set(self, collection_id, records,
return sorted_, total_records - filtered_deleted


class Memory(MemoryBasedStorage):
class Storage(MemoryBasedStorage):
"""Storage backend implementation in memory.
Useful for development or testing purposes, but records are lost after
Expand All @@ -157,7 +157,7 @@ class Memory(MemoryBasedStorage):
cliquet.storage_backend = cliquet.storage.memory
"""
def __init__(self, *args, **kwargs):
super(Memory, self).__init__(*args, **kwargs)
super(Storage, self).__init__(*args, **kwargs)
self.flush()

def flush(self, auth=None):
Expand Down Expand Up @@ -334,4 +334,4 @@ def column(first, record, name):


def load_from_config(config):
return Memory()
return Storage()
14 changes: 7 additions & 7 deletions cliquet/storage/redis.py
Expand Up @@ -21,7 +21,7 @@ def wrapped(*args, **kwargs):
return wrapped


class Redis(MemoryBasedStorage):
class Storage(MemoryBasedStorage):
"""Storage backend implementation using Redis.
.. warning::
Expand All @@ -43,7 +43,7 @@ class Redis(MemoryBasedStorage):
"""

def __init__(self, *args, **kwargs):
super(Redis, self).__init__(*args, **kwargs)
super(Storage, self).__init__(*args, **kwargs)
maxconn = kwargs.pop('max_connections')
connection_pool = redis.BlockingConnectionPool(max_connections=maxconn)
self._client = redis.StrictRedis(connection_pool=connection_pool,
Expand Down Expand Up @@ -295,8 +295,8 @@ def load_from_config(config):
uri = urlparse.urlparse(uri)
pool_size = int(settings['storage_pool_size'])

return Redis(max_connections=pool_size,
host=uri.hostname or 'localhost',
port=uri.port or 6739,
password=uri.password or None,
db=int(uri.path[1:]) if uri.path else 0)
return Storage(max_connections=pool_size,
host=uri.hostname or 'localhost',
port=uri.port or 6739,
password=uri.password or None,
db=int(uri.path[1:]) if uri.path else 0)
2 changes: 1 addition & 1 deletion cliquet/tests/resource/__init__.py
Expand Up @@ -10,7 +10,7 @@ class BaseTest(unittest.TestCase):
resource_class = BaseResource

def setUp(self):
self.storage = memory.Memory()
self.storage = memory.Storage()
self.resource = self.resource_class(request=self.get_request(),
context=self.get_context())
self.model = self.resource.model
Expand Down
2 changes: 1 addition & 1 deletion cliquet/tests/resource/test_views.py
Expand Up @@ -643,7 +643,7 @@ def __init__(self, *args, **kwargs):
super(StorageErrorTest, self).__init__(*args, **kwargs)
self.error = storage_exceptions.BackendError(ValueError())
self.storage_error_patcher = mock.patch(
'cliquet.storage.redis.Redis.create',
'cliquet.storage.redis.Storage.create',
side_effect=self.error)

def test_backend_errors_are_served_as_503(self):
Expand Down
2 changes: 1 addition & 1 deletion cliquet_docs/api/resource.rst
Expand Up @@ -356,7 +356,7 @@ Since some fields can be :ref:`defined as unique <resource-class>` per collectio

If a conflict occurs, an error response is returned with status ``409``.
A ``details`` attribute in the response provides the offending record and
field name. See :ref:`dedicated section about errors <error-responses>`_.
field name. See :ref:`dedicated section about errors <error-responses>`.


HTTP Status Codes
Expand Down
2 changes: 1 addition & 1 deletion cliquet_docs/ecosystem.rst
Expand Up @@ -71,7 +71,7 @@ Alternatively, packages can also be included via configuration:
pyramid_debugtoolbar
There are `many available packages`_, and it is straightforward to build one.
There are `many available packages <curated list>`_, and it is straightforward to build one.

.. _curated list: https://github.com/ITCase/awesome-pyramid

Expand Down
11 changes: 5 additions & 6 deletions cliquet_docs/reference/configuration.rst
Expand Up @@ -57,8 +57,7 @@ To do so, a setting key must be defined for the disabled resources endpoints::

Where:
- **endpoint_type** is either collection or record;
- **resource_name** is the name of the resource (by default, *Cliquet* uses
the name of the class);
- **resource_name** is the name of the resource (by default, *Cliquet* uses the name of the class);
- **method** is the http method (in lower case): For instance ``put``.

For instance, to disable the PUT on records for the *Mushrooms* resource, the
Expand Down Expand Up @@ -272,7 +271,7 @@ Cache
=====

Backend
-------
:::::::

.. code-block:: ini
Expand All @@ -286,7 +285,7 @@ See :ref:`cache backend documentation <cache>` for more details.


Headers
-------
:::::::

It is possible to add cache control headers on a particular resource
for anonymous requests.
Expand All @@ -307,7 +306,7 @@ If setting is set to ``0``, then the resource follows the default behaviour.


CORS
----
::::

By default, CORS headers are cached by clients during 1H (``Access-Control-Max-Age``).

Expand Down Expand Up @@ -336,7 +335,7 @@ in configuration:
Authentication setup
::::::::::::::::::::

*Cliquet* relies on :github:`pyramid multiauth <mozilla-service/pyramid_multiauth>`_
*Cliquet* relies on :github:`pyramid multiauth <mozilla-service/pyramid_multiauth>`
to initialize authentication.

Therefore, any authentication policy can be specified through configuration.
Expand Down
19 changes: 0 additions & 19 deletions cliquet_docs/reference/listeners.rst

This file was deleted.

6 changes: 3 additions & 3 deletions cliquet_docs/reference/resource.rst
@@ -1,8 +1,8 @@
.. _resource:

Resource
########

.. _resource:

*Cliquet* provides a basic component to build resource oriented APIs.
In most cases, the main customization consists in defining the schema of the
records for this resource.
Expand Down Expand Up @@ -100,7 +100,7 @@ a custom collection can be plugged-in:
default_model = TrackedModel
.. _collection:
.. _resource-model:

.. autoclass:: cliquet.resource.Model
:members:
Expand Down
2 changes: 1 addition & 1 deletion cliquet_docs/reference/storage.rst
Expand Up @@ -54,4 +54,4 @@ Storage can be used to store arbitrary data.
storage = request.registry.storage
storage.create(collection_id='__custom', parent_id='', record=data)
See the :ref:`collection` class to manipulate collections of records.
See the :ref:`resource-model` class to manipulate collections of records.

0 comments on commit f54b010

Please sign in to comment.