Skip to content
This repository was archived by the owner on Jan 28, 2020. It is now read-only.

Commit 0485e67

Browse files
committed
Added Roles module docstrings to documentation
Added Roles to docs/api.rst to include it in documentation. Also updated docstrings in files that generated Sphinx errors during build.
1 parent cd4aed0 commit 0485e67

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

docs/api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ Taxonomy
2929
:undoc-members:
3030
:show-inheritance:
3131

32+
Membership
33+
==========
34+
35+
.. automodule:: roles.api
36+
:members:
37+
:undoc-members:
38+
:show-inheritance:
39+

learningresources/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ def get_resource(resource_id, user_id):
225225
user_id (int): Primary key of the user requesting the resource
226226
Returns:
227227
resource (learningresources.LearningResource): Resource
228-
May be None if the resource does not exist or the user does
229-
not have permissions.
228+
May be None if the resource does not exist or the user does
229+
not have permissions.
230230
"""
231231
try:
232232
resource = LearningResource.objects.get(id=resource_id)

roles/api.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Functions for handling roles
2+
Functions for handling roles.
33
"""
44

55
from __future__ import unicode_literals
@@ -16,7 +16,7 @@
1616

1717
def roles_init_new_repo(repo):
1818
"""
19-
Create new groups for the repository
19+
Create new groups for the repository.
2020
2121
It assumes that there are only 3 types of users:
2222
- administrator
@@ -66,7 +66,7 @@ def roles_init_new_repo(repo):
6666

6767
def roles_clear_repo_permissions(repo):
6868
"""
69-
Removes all the permissions a group has on a repo
69+
Remove all the permissions a group has on a repository.
7070
Args:
7171
repo (learningresources.models.Repository): repository
7272
Returns:
@@ -91,7 +91,7 @@ def roles_clear_repo_permissions(repo):
9191

9292
def roles_update_repo(repo, old_slug):
9393
"""
94-
Updates the groups names for the repo
94+
Update the groups names for the repository.
9595
9696
Args:
9797
repo (learningresources.models.Repository): repository used to update
@@ -128,7 +128,7 @@ def assign_user_to_repo_group(
128128
repo,
129129
group_type):
130130
"""
131-
Assigns an user to a repo specific group type
131+
Assign an user to a repo specific group type.
132132
133133
Args:
134134
user (django.contrib.auth.models.User): user
@@ -150,7 +150,7 @@ def remove_user_from_repo_group(
150150
repo,
151151
group_type):
152152
"""
153-
Remove an user to from a repo specific group type
153+
Remove an user from a repository specific group type.
154154
155155
Args:
156156
user (django.contrib.auth.models.User): user
@@ -169,8 +169,8 @@ def remove_user_from_repo_group(
169169

170170
def list_users_in_repo(repo, base_group_type=None):
171171
"""
172-
Lists all the users in the repository groups
173-
If the group type is specified, the list is limited to that group
172+
List all the users in the repository groups.
173+
If the group type is specified, the list is limited to that group.
174174
175175
Args:
176176
repo (learningresources.models.Repository): repository used to extract
@@ -179,7 +179,7 @@ def list_users_in_repo(repo, base_group_type=None):
179179
roles.permissions.BaseGroupTypes
180180
Returns:
181181
list (list of roles.user_models.UserGroup): list of users in one or
182-
all the repository groups
182+
all the repository groups
183183
"""
184184
users_groups = []
185185
if base_group_type is not None:
@@ -203,7 +203,7 @@ def list_users_in_repo(repo, base_group_type=None):
203203

204204
def is_last_admin_in_repo(user, repo):
205205
"""
206-
Checks if user is the last administrator in the repository.
206+
Check if user is the last administrator in the repository.
207207
It does not check if the user is an actual administrator and in that case
208208
it will simply return False
209209

0 commit comments

Comments
 (0)