Example #1
0
    def get(self):
        if self.request.get("langCode"):
            langCode = self.request.get("langCode")

            q = TopicGrps.query(TopicGrps.LangCode == langCode)
            units = q.fetch(999)

            countmap_other_language = {}
            for unit in units:
                logging.info("QQQ: LangCode in clone: %s" % unit.LangCode)
                if unit.LearningUnitID not in countmap_other_language:
                    logging.info("QQQ: LearningUnitID in clone: %s" % unit.LearningUnitID)
                    countmap_other_language[unit.LearningUnitID] = 1

            q = TopicGrps.query(TopicGrps.LangCode == "en")
            units_en = q.fetch(999)

            for unit2 in units_en:
                if unit2.LearningUnitID not in countmap_other_language:
                    logging.info("QQQ: LearningUnitID to add in clone: %s" % unit2.LearningUnitID)
                    logging.info("QQQ: LangCode to add in clone: %s" % langCode)
                    n = TopicGrps(
                        LearningUnitID=unit2.LearningUnitID,
                        Subject=unit2.Subject,
                        Seq=unit2.Seq,
                        Name=unit2.Name,
                        LangCode=langCode,
                        Description=unit2.Description,
                        Status="Pending Translation",
                    )
                    n.put()
            return self.redirect("/topgrps")

        else:
            return self.redirect("/topgrps")
Example #2
0
 def post(self):
     # logging.error('QQQ: templatecreate POST')
     Subject = self.request.get("Subject")
     n = TopicGrps(
         LearningUnitID=self.request.get("Name"),
         Subject=Subject,
         Name=self.request.get("Name"),
         Seq=999,
         LangCode="en",
         Description=self.request.get("Description"),
         Status="Pending Review",
     )
     n.put()
     logging.info("PPP - Preparing to delete TopGrp_units from memcache.")
     memcache.delete("TopGrps_En")
     memcache.delete("TopGrp_EnCnt")
     return self.redirect("/topgrps/create?SubjFilter=" + Subject)