コード例 #1
0
    def get(self):
        # disable caching for landing portal HTML (images still cached)
        # maintains freshness when user uploads new template
        self.response.headers["Cache-Control"] = "no-cache"

        template_uid = self.request.get("tuid") or "714783ff9d4c4248"
        templates = get_all_templates()

        memes = get_last_n_memes(6)
        meme_thumbs = ["/serve?t=m&s=t&id=%s" % m.uid for m in memes]
        meme_urls = ["/serve?t=m&id=%s" % m.uid for m in memes]

        template_data = {
            "templates": templates,
            "template_uid": templates[0][0],
            "thumb1": meme_thumbs[0],
            "thumb2": meme_thumbs[1],
            "thumb3": meme_thumbs[2],
            "thumb4": meme_thumbs[3],
            "thumb5": meme_thumbs[4],
            "thumb6": meme_thumbs[5],
            "full1": meme_urls[0],
            "full2": meme_urls[1],
            "full3": meme_urls[2],
            "full4": meme_urls[3],
            "full5": meme_urls[4],
            "full6": meme_urls[5],
        }
        path = os.path.join(os.path.dirname(__file__), "html/index.html")
        self.response.out.write(template.render(path, template_data))
コード例 #2
0
ファイル: landing.py プロジェクト: AppScale/UW-Meme-Generator
    def get(self):
        # disable caching for landing portal HTML (images still cached)
        # maintains freshness when user uploads new template
        self.response.headers['Cache-Control']="no-cache"

        template_uid = self.request.get('tuid')
        templates = get_all_templates()
        template_data = {
            'templates': templates,
            'template_uid': template_uid
        }
        path = os.path.join(os.path.dirname(__file__), 'html/index.html')
        self.response.out.write(template.render(path, template_data))