Skip to content

Commit

Permalink
Merge pull request #38 from pstch/routers
Browse files Browse the repository at this point in the history
Improved documentation
  • Loading branch information
Hugo Geoffroy committed Jun 26, 2014
2 parents 760a5cc + 6701012 commit d9f5b09
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
class Entity(metaclass=ABCMeta):
"""Abstract class for routed entities
Subclasses should define the abstract :func:`patterns` method, that should
return a generator yielding Django URL objects (``RegexURLPattern`` or
``RegexURLResolver``).
.. warning:: Abstract class ! Subclasses should define the
abstract :func:`patterns` method, that should return
a generator yielding Django URL objects
(``RegexURLPattern`` or ``RegexURLResolver``).
.. inheritance-diagram:: Entity
Expand All @@ -23,9 +24,12 @@ def __init__(self, index=None):

@abstractmethod
def patterns(self, parents=None, add_redirect=True):
"""This abstract method should be defined by subclasses, as a
generator that yields Django URL objects (``RegexURLPattern`` or
``RegexURLResolver``)
"""Yield URL patterns
.. warning:: This abstract method should be defined by
subclasses, and should return a generator
yielding Django URL objects (``RegexURLPattern``
or ``RegexURLResolver``)
"""
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@


def provides(provided, **kwargs):
"""Return a decorator that uses :func:`EntityStore.register_class` to register a class in
the base store"""
"""Return a decorator that uses :func:`EntityStore.register_class` to
register a class in the base store
"""

def register_class_to_router(router):
"""Register the provided class"""
router.register_class(provided, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions django_crucrudile/routers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from django.views.generic.list import MultipleObjectMixin

from django_crucrudile.routes import ViewRoute, ModelViewRoute
from django_crucrudile.entity import Entity
from django_crucrudile.entity.store import EntityStore, provides
from django_crucrudile.entities import Entity
from django_crucrudile.entities.store import EntityStore, provides

__all__ = [
"Router", "BaseModelRouter",
Expand Down
8 changes: 5 additions & 3 deletions django_crucrudile/routes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

from django.conf.urls import url

from django_crucrudile.entity import Entity
from django_crucrudile.entities import Entity


class Route(Entity):
"""Abstract class for a :class:`django_crucrudile.entity.Entity` that
yields URL patterns. Subclasses should define the
:func:`get_callback` function.
yields URL patterns.
.. warning:: Abstract class ! Subclasses should define the
:func:`get_callback` function.
The URL part and URL name must be either set on class, or given at
:func:`__init__`.
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.txt'
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'
Expand Down
22 changes: 0 additions & 22 deletions docs/django_crucrudile.entity.txt

This file was deleted.

10 changes: 0 additions & 10 deletions docs/django_crucrudile.routers.txt

This file was deleted.

10 changes: 0 additions & 10 deletions docs/django_crucrudile.routes.txt

This file was deleted.

19 changes: 0 additions & 19 deletions docs/django_crucrudile.txt

This file was deleted.

7 changes: 7 additions & 0 deletions docs/entities.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Entity (``Entity``)
===================

.. automodule:: django_crucrudile.entities
:members:
:undoc-members:
:show-inheritance:
77 changes: 0 additions & 77 deletions docs/entities.txt

This file was deleted.

7 changes: 7 additions & 0 deletions docs/entity_store.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Entity store (``EntityStoreMetaclass``, ``EntityStore`` and ``provides``)
=========================================================================

.. automodule:: django_crucrudile.entities.store
:members:
:undoc-members:
:show-inheritance:
File renamed without changes.
40 changes: 40 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
django-crucrudile
=================

.. toctree::
installation
getting_started
entity_store
entities
routers
routes

* :ref:`modindex`

Class structure graph
---------------------

.. graphviz::

digraph class_structure {

"Abstract" [color=black, fontcolor=white, style=filled]

"Entity" [color=black, fontcolor=white, style=filled]
"Route" [color=black, fontcolor=white, style=filled]
"ModelRoute" [color=black, fontcolor=white, style=filled]

"Entity" -> "Route"
"Entity" -> "Router"
"EntityStore" -> "Router"

"Router" -> "BaseModelRouter"
"BaseModelRouter" -> "ModelRouter"

"Route" -> "ModelRoute"
"Route" -> "ViewRoute"

"ModelRoute" -> "ModelViewRoute"
"ViewRoute" -> "ModelViewRoute"

}
File renamed without changes.
5 changes: 0 additions & 5 deletions docs/reference.txt

This file was deleted.

7 changes: 7 additions & 0 deletions docs/routers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Routers (``Router``, ``BaseModelRouter`` and ``ModelRouter``)
=============================================================

.. automodule:: django_crucrudile.routers
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/routes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Routes (``Route``, ``ModelRoute``, ``ViewRoute`` and ``ModelViewRoute``)
========================================================================

.. automodule:: django_crucrudile.routes
:members:
:undoc-members:
:show-inheritance:

0 comments on commit d9f5b09

Please sign in to comment.