Beispiel #1
0
 def get(self):
     sessionid = extractkeyfromrequest(self.request, 's')
     if sessionid:
         sessionid = sessionid.strip()
     user = None
     isnewuser = False
     isfuture = False
     isrecservicesclaz = False
     if sessionid:
         cacheservice = MemcacheService()
         user = cacheservice.getsessionuser(sessionid)
         isnewuser = cacheservice.getfromsession(sessionid, "newuser")
     # uid, insession = attemptlogin(self.request)
     # coursesservice = CoursesService()
     # courses = coursesservice.listupcomingcourses()
     template_values = {
         'sessionid': sessionid,
         'user': user,
         'isnewuser': isnewuser,
         'isfuture': isfuture,
         'isrecservicesclaz': isrecservicesclaz
     }
     if sessionid:
         cacheservice.clearfromsession(sessionid, "newuser")
     template = JINJA_ENVIRONMENT.get_template('subscribe.html')
     self.response.write(template.render(template_values))
Beispiel #2
0
 def get(self):
     sessionid = extractkeyfromrequest(self.request, 's')
     if sessionid:
         sessionid = sessionid.strip()
     user = None
     newuser = None
     cacheservice = MemcacheService()
     if sessionid:
         user = cacheservice.getsessionuser(sessionid)
         newuser = cacheservice.getfromsession(sessionid, "newuser")
     # uid, insession = attemptlogin(self.request)
     # coursesservice = CoursesService()
     # courses = coursesservice.listupcomingcourses()
     template_values = {
         'sessionid': sessionid,
         'user': user,
         "newuser": newuser,
     }
     if sessionid:
         cacheservice.clearfromsession(sessionid, "newuser")
     # header_template_values = buildheadertemplatevalues(insession, uid)
     # template_values.update(header_template_values)
     # course_template_values = buildallcoursestemplatevalues(insession, courses)
     # template_values.update(course_template_values)
     template = JINJA_ENVIRONMENT.get_template('curriculum.html')
     self.response.write(template.render(template_values))
Beispiel #3
0
 def get(self):
     sessionid = extractkeyfromrequest(self.request, 's')
     if sessionid:
         sessionid = sessionid.strip()
     user = None
     cacheservice = MemcacheService()
     if sessionid:
         user = cacheservice.getsessionuser(sessionid)
     template_values = {'sessionid': sessionid, 'user': user}
     if sessionid:
         for i in range(1, 101):
             template_values['quiz' + str(i) +
                             'submitted'] = cacheservice.getfromsession(
                                 sessionid, 'quiz' + str(i) + 'submitted')
             template_values['quiz' + str(i) +
                             'results'] = cacheservice.getfromsession(
                                 sessionid, 'quiz' + str(i) + 'results')
             template_values['quiz' + str(i) +
                             'len'] = cacheservice.getfromsession(
                                 sessionid, 'quiz' + str(i) + 'len')
         for i in range(1, 101):
             cacheservice.clearfromsession(sessionid,
                                           'quiz' + str(i) + 'submitted')
             cacheservice.clearfromsession(sessionid,
                                           'quiz' + str(i) + 'results')
             cacheservice.clearfromsession(sessionid,
                                           'quiz' + str(i) + 'len')
     template = JINJA_ENVIRONMENT.get_template('programmingusingjava.html')
     self.response.write(template.render(template_values))
Beispiel #4
0
 def get(self):
     sessionid = extractkeyfromrequest(self.request, 's')
     if sessionid:
         sessionid = sessionid.strip()
     user = None
     isnewuser = False
     isfuture = False
     isrecservicesclaz = False
     if sessionid:
         cacheservice = MemcacheService()
         user = cacheservice.getsessionuser(sessionid)
         isnewuser = cacheservice.getfromsession(sessionid, "newuser")
         claz = cacheservice.getfromsession(sessionid, "claz")
         isfuture = claz == 'Future Sessions'
         isrecservicesclaz = claz == 'Sep 2015 - Nov 2015' or claz == 'Sep 2015 - Nov 2015 (AP)'
     # uid, insession = attemptlogin(self.request)
     # coursesservice = CoursesService()
     # courses = coursesservice.listupcomingcourses()
     template_values = {
         'sessionid': sessionid,
         'user': user,
         'isnewuser': isnewuser,
         'isfuture': isfuture,
         'isrecservicesclaz': isrecservicesclaz
     }
     if sessionid:
         cacheservice.clearfromsession(sessionid, "newuser")
     # uid, insession = attemptlogin(self.request)
     # coursesservice = CoursesService()
     # courses = coursesservice.listupcomingcourses()
     # header_template_values = buildheadertemplatevalues(insession, uid)
     # template_values.update(header_template_values)
     # course_template_values = buildallcoursestemplatevalues(insession, courses)
     # template_values.update(course_template_values)
     template = JINJA_ENVIRONMENT.get_template('register.html')
     self.response.write(template.render(template_values))
Beispiel #5
0
 def get(self):
     sessionid = extractkeyfromrequest(self.request, 's')
     if sessionid:
         sessionid = sessionid.strip()
     user = None
     source = None
     cacheservice = MemcacheService()
     quizresults = []
     hwresults = []
     users = []
     isadmin = False
     profilestudent = None
     if sessionid:
         profilestudent = cacheservice.getfromsession(
             sessionid, 'profilestudent')
         cacheservice.clearfromsession(sessionid, 'profilestudent')
         user = cacheservice.getsessionuser(sessionid)
         if not profilestudent:
             profilestudent = user
         source = translateclaztosource(profilestudent.claz)
         quizanswerarr = quizanswers(source)
         for quizint in range(1, 9):
             if len(quizanswerarr) > quizint:
                 quiz = quizanswerarr[quizint]
                 quizlen = len(quiz)
                 if "free" in quiz:
                     quizlen = quizlen - 1 + quizanswerarr[quizint]["free"]
                 quizresult = getattr(profilestudent,
                                      'quiz' + str(quizint) + 'results')
                 if quizresult is None:
                     quizresult = 0
                 quizresults.append({
                     'total': quizlen,
                     'correct': quizresult
                 })
         hwanswerarr = hwanswers(source)
         for hwint in range(1, 9):
             if len(hwanswerarr) > hwint:
                 hw = hwanswerarr[hwint]
                 hwlen = len(hw)
                 if "free" in hw:
                     hwlen = hwlen - 1 + hwanswerarr[hwint]["free"]
                 hwresult = getattr(profilestudent,
                                    'hw' + str(hwint) + 'results')
                 if hwresult is None:
                     hwresult = 0
                 hwresults.append({'total': hwlen, 'correct': hwresult})
         if user.isadmin:
             isadmin = True
             userservice = TinkerAcademyUserService()
             users = userservice.findusersinclaz(user)
     template_values = {
         'sessionid': sessionid,
         'user': profilestudent,
         'quizresults': quizresults,
         'hwresults': hwresults,
         'users': users,
         'isadmin': isadmin
     }
     template = JINJA_ENVIRONMENT.get_template('profile.html')
     self.response.write(template.render(template_values))
Beispiel #6
0
 def get(self):
     sessionid = extractkeyfromrequest(self.request, 's')
     if sessionid:
         sessionid = sessionid.strip()
     user = None
     cacheservice = MemcacheService()
     if sessionid:
         user = cacheservice.getsessionuser(sessionid)
     template_values = {'sessionid': sessionid, 'user': user}
     for i in range(1, 10):
         template_values['quiz' + str(i) +
                         'submitted'] = cacheservice.getfromsession(
                             sessionid, 'quiz' + str(i) + 'submitted')
         template_values['quiz' + str(i) +
                         'results'] = cacheservice.getfromsession(
                             sessionid, 'quiz' + str(i) + 'results')
         template_values['quiz' + str(i) +
                         'len'] = cacheservice.getfromsession(
                             sessionid, 'quiz' + str(i) + 'len')
     for i in range(1, 10):
         template_values['hw' + str(i) +
                         'submitted'] = cacheservice.getfromsession(
                             sessionid, 'hw' + str(i) + 'submitted')
         template_values['hw' + str(i) +
                         'results'] = cacheservice.getfromsession(
                             sessionid, 'hw' + str(i) + 'results')
         template_values['hw' + str(i) +
                         'len'] = cacheservice.getfromsession(
                             sessionid, 'hw' + str(i) + 'len')
     logging.info("APComputerSciencePage template_values=" +
                  str(template_values))
     if sessionid:
         for i in range(1, 10):
             cacheservice.clearfromsession(sessionid,
                                           'quiz' + str(i) + 'submitted')
             cacheservice.clearfromsession(sessionid,
                                           'quiz' + str(i) + 'results')
             cacheservice.clearfromsession(sessionid,
                                           'quiz' + str(i) + 'len')
         for i in range(1, 10):
             cacheservice.clearfromsession(sessionid,
                                           'hw' + str(i) + 'submitted')
             cacheservice.clearfromsession(sessionid,
                                           'hw' + str(i) + 'results')
             cacheservice.clearfromsession(sessionid, 'hw' + str(i) + 'len')
     template = JINJA_ENVIRONMENT.get_template('apcomputerscience.html')
     self.response.write(template.render(template_values))