Exemple #1
0
    def process_sat(self):
        params = web.input()
        attrs = { k : int(params[k]) for k in ['writing', 'reading', 'math'] }
        attrs['uid'] = self.key

        s = SatScore.get_by_key_name(self.key)
        if not s:
            s = SatScore(key_name=self.key, **attrs)
        else:
            for k, v in attrs.iteritems():
                setattr(s, k, v)

        try:
            s.put()
        except TransactionFailedError:
            # Ideally handle the error
            pass
Exemple #2
0
 def GET(self):
     p = Profile.get_by_key_name(self.key) or {}
     s = SatScore.get_by_key_name(self.key) or {}
     sat2s = SatSubjectScore.all().filter('uid =', self.key)
     return super(self.__class__, self).GET({
         'profile' : p,
         'sat' : s,
         'sat2s' : sat2s,
         'groups' : SatSubjectScore._subject_categories,
         'subjects' : SatSubjectScore._subjects
     })