CAT-SOOP API: catsoop.groups
Members
-
catsoop.groups.add_to_group (
function, lines 90-120)Adds the given user to the given group.
Parameters:
context: the context associated with this requestpath: a list of strings representing the path we're interested inusername: the user whose group we want to findgroup: the name of the group to which the student should be added
Returns:
Noneon success, or an error message on failure.
-
catsoop.groups.get_group (
function, lines 58-87)Get a user's group for a page
Parameters:
context: the context associated with this requestpath: a list of strings representing the path we're interested inusername: the user whose group we want to find
Optional Parameters:
groups(defaultNone): a listing of groups (of the same form as the output fromcatsoop.groups.list_groups). If none is specified,catsoop.groups.list_groupsis invoked.secnum(defaultNone): the section in which to look for groups. If none is specified,catsoop.groups.get_sectionis invoked).
Returns: the section number and group to which the given user belongs, or None if they have not been assigned a group.
-
catsoop.groups.get_section (
function, lines 38-55)Helper function to determine a user's section, if any.
Parameters:
context: the context associated with this requestcourse: the courseusername: the user whose section we want to find
Returns: a string; the user's section, or
'default'if the user has no section
-
catsoop.groups.list_groups (
function, lines 25-35)Parameters:
context: the context associated with this requestpath: a list of strings representing the path we're interested in
Returns: a dictionary mapping group names to lists of group members
-
catsoop.groups.make_all_groups (
function, lines 182-250)Randomly assigns groups within the given section for the given page, overwriting any existing groups for that section and page.
All users with a file in
__USERS__who are members of the given section are considered.Several variables in the given
contextaffect the way groups are assigned:-
The students can optionally be separated into subcategories (such that each student will only be partnered with other within their subcategory) by specifying a function
cs_group_category(path, username) => category_name. -
The names to be given to the various groups can be specified in
cs_group_names, which should be a list of strings. -
Within each subcategory, students are randomly shuffled, and groups of size
cs_group_sizeare made from the shuffled list. Students will never be paired with students outside their subcategory, even iscs_group_sizedoes not evenly divide the number of students in a category.
Parameters:
context: the context associated with this requestpath: a list of strings representing the path we're interested insection: the section whose groups should be replaced
Returns:
Noneon success, or an error message on failure. -
-
catsoop.groups.overwrite_groups (
function, lines 156-179)Overwrites group assignments for the given section
Parameters:
context: the context associated with this requestpath: a list of strings representing the path we're interested insection: the section whose groups should be replacednewdict: the new group assignments, as a dictionary mapping group names to lists of group members' usernames
Returns:
Noneon success, or an error message on failure.
-
catsoop.groups.remove_from_group (
function, lines 123-153)Removes the given user from the given group.
Parameters:
context: the context associated with this requestpath: a list of strings representing the path we're interested inusername: the user whose group we want to findgroup: the name of the group from which the student should be removed
Returns:
Noneon success, or an error message on failure.