Skip to content

Commit

Permalink
improved code layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Oct 29, 2019
1 parent 0e3dd9d commit bc1f1fa
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Using it is as simple as this:

.. code-block:: python
from piccolo_api.endpoints.crud import PiccoloCRUD
from piccolo_api.crud.endpoints import PiccoloCRUD
from .tables import MyTable
Expand All @@ -39,7 +39,7 @@ To expose several CRUD endpoints in our app, we use Starlette's Router.

.. code-block:: python
from piccolo_api.endpoints.crud import PiccoloCRUD
from piccolo_api.crud.endpoints import PiccoloCRUD
from starlette.routing import Mount, Router
from .tables import Table1, Table2, Table3
Expand Down
7 changes: 7 additions & 0 deletions docs/source/crud/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CRUD
====

.. toctree::
:maxdepth: 1

./endpoints
7 changes: 7 additions & 0 deletions docs/source/csp/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CSP
===

.. toctree::
:maxdepth: 1

./middleware
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ against cross site scripting.

.. code-block:: python
from piccolo_api.middleware.csp import CSPMiddleware
from piccolo_api.csp.middleware import CSPMiddleware
wrapped_asgi_app = CSPMiddleware(asgi_app)
Expand Down
8 changes: 0 additions & 8 deletions docs/source/endpoints/index.rst

This file was deleted.

5 changes: 3 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ tables into a working REST API, using ASGI.
:maxdepth: 2
:caption: Contents:

./endpoints/index
./middleware/index
./crud/index
./csp/index
./jwt/index
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This creates an endpoint for logging in, and getting a JSON Web Token (JWT).
.. code-block:: python
from starlette.routing import Route, Router
from piccolo_api.endpoints.auth import jwt_login
from piccolo_api.jwt_auth.endpoints import jwt_login
from .tables import User
from settings import SECRET
Expand Down
8 changes: 8 additions & 0 deletions docs/source/jwt/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
JWT
===

.. toctree::
:maxdepth: 1

./endpoints
./middleware
File renamed without changes.
8 changes: 0 additions & 8 deletions docs/source/middleware/index.rst

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file removed piccolo_api/middleware/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from starlette.status import HTTP_303_SEE_OTHER
from starlette.templating import Jinja2Templates

from piccolo_api.tables.sessions import SessionsBase
from piccolo_api.session_auth.tables import SessionsBase


TEMPLATES = Jinja2Templates(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import typing as t

from piccolo.extensions.user import BaseUser as PiccoloBaseUser
from piccolo_api.tables.sessions import SessionsBase
from piccolo_api.session_auth.tables import SessionsBase
from starlette.authentication import (
AuthenticationBackend,
AuthCredentials,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_csp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import TestCase

from piccolo_api.middleware.csp import CSPMiddleware, CSPConfig
from piccolo_api.csp.middleware import CSPMiddleware, CSPConfig
from starlette.testclient import TestClient


Expand Down
6 changes: 3 additions & 3 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from starlette.routing import Mount, Route, Router
from starlette.testclient import TestClient

from piccolo_api.tables.sessions import SessionsBase
from piccolo_api.endpoints.session import session_login
from piccolo_api.middleware.session import SessionsAuthBackend
from piccolo_api.session_auth.tables import SessionsBase
from piccolo_api.session_auth.endpoints import session_login
from piccolo_api.session_auth.middleware import SessionsAuthBackend


SQLITE_PATH = os.path.join(os.path.dirname(__file__), "./session.sqlite")
Expand Down

0 comments on commit bc1f1fa

Please sign in to comment.