Skip to content

Commit

Permalink
Minor fixes to developer documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cript0nauta committed Aug 13, 2018
1 parent 2a30f7b commit deef3e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/creating_views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ them based on your needs.
.. _`Django REST Framework`: http://django-rest-framework.org/

The first thing you will need is a working SQLAlchemy model. Based on wether
that model will be available on only one workspace (like the majority of out
that model will be available on only one workspace (like the majority of our
models) or in all the workspaces (like vuln templates or licenses) the things
are a bit different.

Expand Down Expand Up @@ -62,7 +62,7 @@ app in the ``server/app.py`` file::
That is the code of the view. It will have list, detail, create, update, remove
and count endpoints, and all of them will be functional. If you want to only
enable some of them you should inherit from ``GenericWorkspacedView`` and from
some mixins that define each endpoint's behavior.
some mixins that implement each method's behavior.

If you look at the view's code, the only thing it does is to define three
atrributes: ``route_base``, to define what is going on the URL, the class of
Expand Down
9 changes: 7 additions & 2 deletions doc/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ ecosystem.
`SQLAlchemy`_
^^^^^^^^^^^^^

A really powerful Object Relational Mapper for Python that allows us to map
results of SQL queries to instances of Python objects
A really powerful but complex Object Relational Mapper for Python that allows
us to map results of SQL queries to instances of Python objects. Sometimes it
looks made by Java developers rather than Python devs.

`Flask-Classful`_
^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -86,6 +87,10 @@ Other libraries we use
* `Filteralchemy`_ to make query filters in a declarative way, inspired on
`django-filter`_

.. note::
This library is unmantained, so we have our own fork of it hosted on
https://github.com/infobyte/filteralchemy

.. _`django-filter`: https://github.com/carltongibson/django-filter
.. _`Filteralchemy`: http://filteralchemy.readthedocs.io/

Expand Down
9 changes: 5 additions & 4 deletions doc/recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ For example, lets see the code of the vulns API::
if pagination_metadata is not None else len(vulns))
}

Ensure that you correctly handle the case of ``pagination_metadata`` being
None. This happens when the user doesn't specify the page number or size, so
all the objects will be shown.
.. warning::
Ensure that you correctly handle the case of ``pagination_metadata`` being
None. This happens when the user doesn't specify the page number or size, so
all the objects will be shown.


.. _`flask_sqlalchemy.Pagination`: http://flask-sqlalchemy.pocoo.org/2.3/api/#utilities
Expand All @@ -80,7 +81,7 @@ Adding filters
==============

If you want to enable the API clients to filter by a specific field, you should
inherit from the ``PaginatedMixin`` (this isn't done by default like with
inherit from the ``FilterAlchemyMixin`` (this isn't done by default like with
``SortableMixin``). Then you define a ``filterset_class`` attribute in your
class indicating the `filteralchemy filterset`_ to use::

Expand Down

0 comments on commit deef3e1

Please sign in to comment.