Skip to content

Commit 000996b

Browse files
Fix literalincludes
1 parent c8afe8b commit 000996b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/example_db_auth.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ Database
2323
When the application runs, we initialise the DB with sample data using SQLAlchemy
2424
ORM:
2525

26-
.. literalinclude:: demo/database_auth/main.py
26+
.. literalinclude:: ../demo/database_auth/main.py
2727
:pyobject: init_db
2828

2929

3030
This will consist of 2 tables/models created in ``db.py``:
3131

3232
Users:
3333

34-
.. literalinclude:: demo/database_auth/db.py
34+
.. literalinclude:: ../demo/database_auth/db.py
3535
:pyobject: User
3636

3737
And their permissions:
3838

39-
.. literalinclude:: demo/database_auth/db.py
39+
.. literalinclude:: ../demo/database_auth/db.py
4040
:pyobject: Permission
4141

4242

@@ -59,15 +59,15 @@ database-based authorization policy.
5959
In our example we will lookup a user login in the database and, if present, return
6060
the identity.
6161

62-
.. literalinclude:: demo/database_auth/db_auth.py
62+
.. literalinclude:: ../demo/database_auth/db_auth.py
6363
:pyobject: DBAuthorizationPolicy.authorized_userid
6464

6565

6666
For permission checking, we will fetch the user first, check if he is superuser
6767
(all permissions are allowed), otherwise check if the permission is explicitly set
6868
for that user.
6969

70-
.. literalinclude:: demo/database_auth/db_auth.py
70+
.. literalinclude:: ../demo/database_auth/db_auth.py
7171
:pyobject: DBAuthorizationPolicy.permits
7272

7373

@@ -76,7 +76,7 @@ Setup
7676

7777
Once we have all the code in place we can install it for our application:
7878

79-
.. literalinclude:: demo/database_auth/main.py
79+
.. literalinclude:: ../demo/database_auth/main.py
8080
:pyobject: init_app
8181

8282
Now we have authorization and can decorate every other view with access rights
@@ -86,12 +86,12 @@ based on permissions. There are two helpers included for this::
8686

8787
For each view you need to protect - just apply the decorator on it.
8888

89-
.. literalinclude:: demo/database_auth/handlers.py
89+
.. literalinclude:: ../demo/database_auth/handlers.py
9090
:pyobject: Web.protected_page
9191

9292
or
9393

94-
.. literalinclude:: demo/database_auth/handlers.py
94+
.. literalinclude:: ../demo/database_auth/handlers.py
9595
:pyobject: Web.logout
9696

9797
If someone tries to access that protected page he will see::
@@ -110,7 +110,7 @@ function may do what you are trying to accomplish::
110110

111111
from passlib.hash import sha256_crypt
112112

113-
.. literalinclude:: demo/database_auth/db_auth.py
113+
.. literalinclude:: ../demo/database_auth/db_auth.py
114114
:pyobject: check_credentials
115115

116116

0 commit comments

Comments
 (0)