当前位置: 首页>>代码示例>>Python>>正文


Python Courses.get_users方法代码示例

本文整理汇总了Python中oasis.lib.Courses.get_users方法的典型用法代码示例。如果您正苦于以下问题:Python Courses.get_users方法的具体用法?Python Courses.get_users怎么用?Python Courses.get_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oasis.lib.Courses的用法示例。


在下文中一共展示了Courses.get_users方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: practice_choose_topic

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_users [as 别名]
def practice_choose_topic(course_id):
    """ Present a list of topics for them to choose from the given course """
    user_id = session['user_id']
    try:
        course = Courses2.get_course(course_id)
    except KeyError:
        course = None
        abort(404)
    try:
        topics = Courses2.get_topics_list(course_id)
    except KeyError:
        topics = []
        abort(404)

    members = None
    for topic in topics:
        if topic['visibility'] == 2:  # course only
            if not members:
                members = Courses.get_users(course_id)
            if not user_id in members:
                topics.remove(topic)
    return render_template(
        "practicecourse.html",
        courses=Setup.get_sorted_courselist(),
        canpreview=check_perm(user_id, course_id, "questionpreview"),
        topics=topics,
        course=course
    )
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:30,代码来源:views_practice.py

示例2: practice_choose_question

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_users [as 别名]
def practice_choose_question(topic_id):
    """ Present a list of questions for them to choose from the given topic """
    user_id = session['user_id']
    try:
        course_id = Topics.get_course_id(topic_id)
    except KeyError:
        course_id = None
        abort(404)
    topics = []
    try:
        topics = Courses2.get_topics_list(course_id)
    except KeyError:
        abort(404)
    try:
        course = Courses2.get_course(course_id)
    except KeyError:
        course = None
        abort(404)
    topictitle = Topics.get_name(topic_id)
    questions = Practice.get_sorted_questions(course_id, topic_id, user_id)

    thistopic = Topics.get_topic(topic_id)
    members = []
    if thistopic['visibility'] == 2:  # course only
        if not members:
            members = Courses.get_users(course_id)
            if not user_id in members:
                abort(404)

    for topic in topics:
        if topic['visibility'] == 2:  # course only
            if not members:
                members = Courses.get_users(course_id)
            if not user_id in members:
                topics.remove(topic)

    return render_template(
        "practicetopic.html",
        canpreview=check_perm(user_id, course_id, "questionpreview"),
        topics=topics,
        topic_id=topic_id,
        course=course,
        topictitle=topictitle,
        questions=questions
    )
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:47,代码来源:views_practice.py

示例3: admin_course_save

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_users [as 别名]
def admin_course_save(course_id):
    """ accept saved settings """
    form = request.form
    cancel_edit = form.get("cancel_edit", False)
    if cancel_edit:
        flash("Course edits cancelled")
        return redirect(url_for("admin_courses"))

    changed = False
    course = Courses2.get_course(course_id)
    groups = Courses.get_groups(course_id)

    for g_id, group in groups.iteritems():
        if form.get('delgroup_%s' % g_id):
            changed = True
            flash("Removing group %s" % group.name, "info")
            Courses.del_group(int(g_id), course_id)

    if 'course_name' in form:
        name = form['course_name']
        if not name == course['name']:
            changed = True
            Courses.set_name(course_id, name)

    if 'course_title' in form:
        title = form['course_title']
        if not title == course['title']:
            changed = True
            Courses.set_title(course_id, title)

    if 'course_active' in form:
        active = form['course_active']
        if active == '1' or active == 1:
            active = True
        else:
            active = False
        if not (active == course['active']):
            changed = True
            Courses.set_active(course_id, active)

    addbtn = form.get('group_addbtn')
    if addbtn:
        newgroup = form.get('addgroup', None)
        if newgroup:
            Courses.add_group(newgroup, course_id)
            changed = True
            group = Groups.Group(newgroup)
            flash("Group %s added." % group.name)

    if changed:
        Courses2.reload_if_needed()
        flash("Course changes saved!")
        return redirect(url_for("admin_course", course_id=course_id))

    course = Courses2.get_course(course_id)
    course['size'] = len(Courses.get_users(course_id))
    return redirect(url_for("admin_courses"))
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:59,代码来源:views_admin.py

示例4: get_sorted_courselist

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_users [as 别名]
def get_sorted_courselist(with_stats=False, only_active=True):
    """Return a list of courses suitable for choosing one to edit
         [  ('example101', { coursedict }),  ('sorted302', { coursedict } )  ]
    """

    courses = Courses2.get_course_dict(only_active=only_active)

    inorder = []
    for cid, course in courses.iteritems():
        if with_stats:
            course['students'] = Courses.get_users(cid)
            course['size'] = len(course['students'])
        inorder.append((course['name'], course))
    inorder.sort()
    return inorder
开发者ID:tkanesh,项目名称:oasisqe,代码行数:17,代码来源:Setup.py

示例5: admin_course

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_users [as 别名]
def admin_course(course_id):
    """ Present page to administer settings for a given course"""

    course = Courses2.get_course(course_id)
    course['size'] = len(Courses.get_users(course_id))
    groups = Courses.get_groups(course_id)
    choosegroups = [group
                    for g_id, group in Groups.enrolment_groups().iteritems()
                    if not g_id in groups]
    return render_template(
        "cadmin_course.html",
        course=course,
        groups=groups,
        choosegroups=choosegroups
    )
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:17,代码来源:views_admin.py


注:本文中的oasis.lib.Courses.get_users方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。