示例#1
0
    def get(self):
        if self.request.get('langCode'):
            langCode = self.request.get('langCode')

            q = LearnAids.query(LearnAids.LangCode == langCode)
            aids = q.fetch(999)

            countmap_other_language={}
            for aid in aids:
                logging.info('QQQ: LangCode in clone: %s' % aid.LangCode)
                if aid.LearnAidID not in countmap_other_language:
                    logging.info('QQQ: LearnAidID in clone: %s' % aid.LearnAidID)
                    countmap_other_language[aid.LearnAidID] = 1

            q = LearnAids.query(LearnAids.LangCode == 'en')
            aids_en = q.fetch(999)

            for aid2 in aids_en:
                if aid2.LearnAidID not in countmap_other_language:
                    logging.info('QQQ: LearnAidID to add in clone: %s' % aid2.LearnAidID)
                    logging.info('QQQ: LangCode to add in clone: %s' % langCode)
                    n = LearnAids(LearnAidID = aid2.LearnAidID
                        , Subject = aid2.Subject
                        , Name = aid2.Name
                        , Seq = aid2.Seq
                        , VideoStatus = 'Pending Translation'
                        , LangCode = langCode
                        , Description = aid2.Description
                        , Status = 'Pending Translation'
                        )
                    n.put()
            return self.redirect('/aids')        

        else:
            return self.redirect('/aids')  
示例#2
0
 def post(self):
     #logging.error('QQQ: templatecreate POST')
     n = LearnAids(LearnAidID = self.request.get('Name')
               , Subject=self.request.get('Subject')
               , Name = self.request.get('Name')
               , Seq = 999
               , LangCode = 'en'
               , Description=self.request.get('Description')
               , Status = 'Pending Review'
               )
     n.put()
     return self.redirect('/aids/create')