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


Python Student.get_enrolled_student_by_email方法代码示例

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


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

示例1: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        """Handles GET request."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return

        student = Student.get_enrolled_student_by_email(user.email())
        if student:
            self.redirect("/course")
            return

        # Check global student data
        namespace = namespace_manager.get_namespace()
        try:
            namespace_manager.set_namespace("")
            student = Student.get_enrolled_student_by_email(user.email())
        finally:
            namespace_manager.set_namespace(namespace)

        if student:
            create_or_enroll_student(user, student.name)
            self.template_value["navbar"] = {"registration": True}
            self.render("confirmation.html")
            return

        self.template_value["navbar"] = {"registration": True}
        self.template_value["register_xsrf_token"] = XsrfTokenManager.create_xsrf_token("register-post")
        self.render("register.html")
开发者ID:sesamesushi,项目名称:satisrevude,代码行数:31,代码来源:utils.py

示例2: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        """Handles GET requests."""
        
        user = self.personalize_page_and_get_user()
        student = Student.get_by_email(user.email())

        if not user:
            self.template_value['loginUrl'] = users.create_login_url('/')
        else:
            self.template_value['playlist'] = student.playlist
            self.template_value['playlist_urls'] = student.playlist_urls
            self.template_value['email'] = user.email()
            self.template_value['logoutUrl'] = users.create_logout_url('/')

        if len(student.playlist) > 0:
            #unit_id = str(student.playlist[0][0])
            #lesson_id = str(student.playlist[0][2])
            self.template_value['start_plist_url'] = str(student.playlist[0]) #('unit?unit=%s&lesson=%s' % (unit_id, lesson_id))
            self.template_value['hasList'] = True
            
        else:
            self.template_value['hasList'] = False
        self.template_value['navbar'] = {'course': True}
        self.template_value['units'] = self.get_units()
        if user and Student.get_enrolled_student_by_email(user.email()):
            self.render('playlist.html')
        else:
            self.redirect('/preview')
开发者ID:supunkamburugamuve,项目名称:mooc,代码行数:30,代码来源:utils.py

示例3: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        param_map = {}
        for k in self.request.arguments():
            param_map[k] = self.request.get(k)
        client_id = param_map.get('client_id', 0)

        logging.debug("vanilla request: " + str(param_map))

        user = users.get_current_user()
        if Roles.is_course_admin(self.app_context):
            role= "administrator"
        else:
            role="member"

        logging.debug(str(user))

        if user:
            student = Student.get_enrolled_student_by_email(user.email())
            user = {
                "name": student.name,
                "email": user.email(),
                "uniqueid": user.user_id(),
                "photourl": "",
            }
        course = self.app_context.get_environ()['course']

        client_id = course['VANILLA_CLIENT_ID']
        secret_key = course['VANILLA_SECRET_KEY']

        jsconn_str = get_jsconnect_string(user, param_map, client_id, secret_key)

        logging.debug("mooc-ed response: " + jsconn_str)

        self.response.out.write(jsconn_str)
开发者ID:barkinet,项目名称:coursebuilder_plugin_vanilla,代码行数:36,代码来源:vanilla.py

示例4: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        """Handles GET requests."""
        user = users.get_current_user()
        if not user:

            self.template_value['loginUrl'] = (
                users.create_login_url(self.request.uri))


            # self.template_value['fedLoginUrl'] = (
            #     users.create_login_url(self.request.uri, None, 'http://dev-hidden.africanmanagers.org'))

        else:
            self.template_value['email'] = user.email()
            self.template_value['logoutUrl'] = (
                users.create_logout_url(self.request.uri))

        self.template_value['navbar'] = {'course': True}
        self.template_value['units'] = self.get_units()
        if user and Student.get_enrolled_student_by_email(user.email()):
            self.redirect('/course')
        else:

            self.template_value['enroll']=True;
            self.render('preview.html')
开发者ID:graemian,项目名称:ami-mooc-pilot,代码行数:27,代码来源:utils.py

示例5: get_list

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get_list(self):
        """Shows a list of announcements."""
        student = None
        user = self.personalize_page_and_get_user()
        transient_student = False
        if user is None:
            transient_student = True
        else:
            student = Student.get_enrolled_student_by_email(user.email())
            if not student:
                transient_student = True
        self.template_value['transient_student'] = transient_student

        items = AnnouncementEntity.get_announcements()
        if not items and AnnouncementsRights.can_edit(self):
            items = self.put_sample_announcements()

        items = AnnouncementsRights.apply_rights(self, items)
        if not roles.Roles.is_course_admin(self.get_course().app_context):
            items = models.LabelDAO.apply_course_track_labels_to_student_labels(
                self.get_course(), student, items)

        self.template_value['announcements'] = self.format_items_for_template(
            items)
        self._render()
开发者ID:CSCI1200Course,项目名称:csci1200OnlineCourse,代码行数:27,代码来源:announcements.py

示例6: personalize_page_and_get_enrolled

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def personalize_page_and_get_enrolled(
        self, supports_transient_student=False):
        """If the user is enrolled, add personalized fields to the navbar."""
        user = self.personalize_page_and_get_user()
        if user is None:
            student = TRANSIENT_STUDENT
        else:
            student = Student.get_enrolled_student_by_email(user.email())
            if not student:
                self.template_value['transient_student'] = True
                student = TRANSIENT_STUDENT

        if student.is_transient:
            if supports_transient_student and (
                    self.app_context.get_environ()['course']['browsable']):
                return TRANSIENT_STUDENT
            elif user is None:
                self.redirect(
                    users.create_login_url(self.request.uri), normalize=False
                )
                return None
            else:
                self.redirect('/preview')
                return None

        # Patch Student models which (for legacy reasons) do not have a user_id
        # attribute set.
        if not student.user_id:
            student.user_id = user.user_id()
            student.put()

        return student
开发者ID:joseespino,项目名称:Google-Course-Builder-1.6.0-Modified-,代码行数:34,代码来源:utils.py

示例7: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        """Handles GET request."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(
                users.create_login_url(self.request.uri), normalize=False)
            return

        student = Student.get_enrolled_student_by_email(user.email())
        if student:
            self.redirect('/course')
            return

        can_register = self.app_context.get_environ(
            )['reg_form']['can_register']
        if not can_register:
            self.redirect('/course#registration_closed')
            return

        # pre-fill nick name from the profile if available
        self.template_value['current_name'] = ''
        profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
        if profile and profile.nick_name:
            self.template_value['current_name'] = profile.nick_name

        self.template_value['navbar'] = {}
        self.template_value['transient_student'] = True
        self.template_value['register_xsrf_token'] = (
            XsrfTokenManager.create_xsrf_token('register-post'))

        self.render('register.html')
开发者ID:joseespino,项目名称:Google-Course-Builder-1.6.0-Modified-,代码行数:33,代码来源:utils.py

示例8: get_list

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get_list(self):
        """Shows a list of announcements."""
        user = self.personalize_page_and_get_user()
        transient_student = False
        if user is None:
            transient_student = True
        else:
            student = Student.get_enrolled_student_by_email(user.email())
            if not student:
                transient_student = True
            else:
                # CGL-MOOC-Builder starts:
                # Set template value for progress bar that shows on the top navigation(header.html)
                total_progress = (self.get_progress_tracker().get_overall_progress_score(student))
                self.template_value['progress_value'] = total_progress.get('progress_score', 0)
                self.template_value['complete_value'] = total_progress.get('completed_score', 0)
                self.template_value['percentage'] = total_progress.get('percentage', '')
                # CGL-MOOC-Builder ends

        self.template_value['transient_student'] = transient_student

        items = AnnouncementEntity.get_announcements()
        if not items and AnnouncementsRights.can_edit(self):
            items = self.put_sample_announcements()

        items = AnnouncementsRights.apply_rights(self, items)

        self.template_value['announcements'] = self.format_items_for_template(
            items)
        self.template_value['navbar'] = {'announcements': True}
        self.render('announcements.html')
开发者ID:cglmoocs,项目名称:cgl-mooc-builder,代码行数:33,代码来源:announcements.py

示例9: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
 def get(self):
   user = users.get_current_user()
   if user:
     if Student.get_enrolled_student_by_email(user.email()):
       self.redirect('/course')
     else:
       page = self.getOrCreatePage('loggedin_preview_page', utils.CoursePreviewHandler())
       self.serve(page, user.email())
   else:
     page = self.getOrCreatePage('anonymous_preview_page', utils.CoursePreviewHandler())
     self.serve(page)
开发者ID:maxwillzq,项目名称:AllAboutPython,代码行数:13,代码来源:servings.py

示例10: post_save

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def post_save(self):
        if not Roles.is_course_admin(self.app_context):
            self.abort(403, 'You are not an admin :(')
        user = self.personalize_page_and_get_enrolled()

        student_email = self.request.GET.get('email', None)
        if not student_email:
            self.abort(404, 'email= parameter required')
        student = Student.get_enrolled_student_by_email(student_email)
        if not student:
            self.abort(404, Markup('Could not find a student with email "%s"') % student_email)

        badge_slug = custom_badge_name(student)
        badge = Badge.get_or_insert(badge_slug)

        badge_form = BadgeForm(self.request.POST, badge)
        comments_form = CommentsForm(self.request.POST)
        if not (badge_form.validate() and comments_form.validate()):
            self.render_edit(badge_form, comments_form)
            return

        comments_form.validate()
        reviewer = Student.get_by_email(comments_form.review_source.data)
        if not reviewer:
            comments_form.review_source.errors.append("Could not find a user with that e-mail address")
            self.render_edit(badge_form, comments_form)
            return

        page = WikiPage.get_page(student, unit=UNIT_NUMBER)
        if not page:
            self.abort(404, Markup('Could not find unit %d wikifolio for student "%s"') % (UNIT_NUMBER, student_email))

        old_reviews = Annotation.reviews(whose=student, unit=UNIT_NUMBER).run()
        db.delete(old_reviews)
        Annotation.review(page, who=reviewer, text=comments_form.public_comments.data)

        if not Annotation.endorsements(what=page, who=user).count(limit=1):
            Annotation.endorse(page, who=user, optional_done=True)
        
        badge_form.populate_obj(badge)
        badge.put()

        report = PartReport.on(student, self.get_course(), 4, force_re_run=True, put=False)
        for rep in report.unit_reports:
            rep._run()
            rep.put()
        report.slug = badge_slug
        report.put()
        assertion = Badge.issue(badge, student, put=False)
        assertion.evidence = urljoin(self.request.host_url, '/badges/evidence?id=%d' % report.key().id())
        assertion.put()
        self.response.write(
                Markup("Issued badge %s to %s, evidence %s") % (
                    badge.key().name(), student_email, assertion.evidence))
开发者ID:twiffy,项目名称:eabooc,代码行数:56,代码来源:custom_badge.py

示例11: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
  def get(self):
    user = self.personalizePageAndGetUser()
    if not user:
      self.redirect(users.create_login_url(self.request.uri))
      return

    student = Student.get_enrolled_student_by_email(user.email())
    if student:
      self.templateValue['student'] = student
    self.templateValue['navbar'] = {'registration': True}
    self.render('unenroll_confirmation_check.html')
开发者ID:maxwillzq,项目名称:AllAboutPython,代码行数:13,代码来源:utils.py

示例12: personalize_page_and_get_enrolled

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def personalize_page_and_get_enrolled(self):
        """If the user is enrolled, add personalized fields to the navbar."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return None

        student = Student.get_enrolled_student_by_email(user.email())
        if not student:
            self.redirect('/preview')
            return None

        return student
开发者ID:osushkov,项目名称:greekcoursebuilder,代码行数:15,代码来源:utils.py

示例13: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        """Handles GET requests."""
        user = self.personalize_page_and_get_user()
        if user is None:
            student = TRANSIENT_STUDENT
        else:
            student = Student.get_enrolled_student_by_email(user.email())
            if not student:
                student = TRANSIENT_STUDENT

        # If the course is browsable, or the student is logged in and
        # registered, redirect to the main course page.
        if ((student and not student.is_transient) or
            self.app_context.get_environ()['course']['browsable']):
            self.redirect('/course')
            return
        units = self.get_units()
        self.template_value['transient_student'] = True
        self.template_value['can_register'] = self.app_context.get_environ(
            )['reg_form']['can_register']
        self.template_value['navbar'] = {'course': True}
        self.template_value['units'] = units
        self.template_value['show_registration_page'] = True
        course = self.app_context.get_environ()['course']
        self.template_value['video_exists'] = bool(
            'main_video' in course and
            'url' in course['main_video'] and
            course['main_video']['url'])
        self.template_value['image_exists'] = bool(
            'main_image' in course and
            'url' in course['main_image'] and
            course['main_image']['url'])

        #get all lessons info
        all_lessons = {}
        for u in units:
            if u.type == 'U':
                all_lessons[u.unit_id] = get_all_lesson(self, u.unit_id)

        self.template_value['all_lessons'] = all_lessons

        if user:
            profile = StudentProfileDAO.get_profile_by_user_id(user.user_id())
            additional_registration_fields = self.app_context.get_environ(
                )['reg_form']['additional_registration_fields']
            if profile is not None and not additional_registration_fields:
                self.template_value['show_registration_page'] = False
                self.template_value['register_xsrf_token'] = (
                    XsrfTokenManager.create_xsrf_token('register-post'))
        self.render('preview.html')
开发者ID:sidds1601,项目名称:BigDataMOOC,代码行数:52,代码来源:utils.py

示例14: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        """Handles GET request."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return

        student = Student.get_enrolled_student_by_email(user.email())
        if student:
            self.redirect("/course")
            return

        self.template_value["navbar"] = {"registration": True}
        self.template_value["register_xsrf_token"] = XsrfTokenManager.create_xsrf_token("register-post")
        self.render("register.html")
开发者ID:roderickfanou,项目名称:Learning_analytics_on_GCB,代码行数:17,代码来源:utils.py

示例15: get

# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import get_enrolled_student_by_email [as 别名]
    def get(self):
        """Handles GET request."""
        user = self.personalize_page_and_get_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return

        student = Student.get_enrolled_student_by_email(user.email())
        if student:
            self.redirect('/course')
            return

        self.template_value['navbar'] = {'registration': True}
        self.template_value['register_xsrf_token'] = (
            XsrfTokenManager.create_xsrf_token('register-post'))
        self.render('register.html')
开发者ID:supunkamburugamuve,项目名称:mooc,代码行数:18,代码来源:utils.py


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