def index(request): tags = Tag.get_tags_by_frequency() template_values = {} template_values["tags"] = tags return render(template_values)
def gen_tag_cloud(): tags = memcache.get('tag_cloud') if not tags: tags = Tag.get_cloud(steps=5, limit=50) for tag in tags: logging.debug('got tags: %s[%s]' % (tag.tag, tag.font_size)) tag.font_size_percent = 80 + int(tag.font_size)*20 random.shuffle(tags) memcache.set('tag_cloud', tags, SECS_HOUR)
def index(request): tags = Tag.get_tags_by_frequency() concated = "" for t in tags: concated += t.tag + str(t.tagged_count) + ", " return HttpResponse("So many tags! " + concated)
def get(self): page = self.get_argument("page", None) if page == None: page = 1 #entries = db.Query(Entry).order('-published').fetch(limit=20) pagedquery = PagedQuery(Entry.all(), 10) pagedquery.order('-published') last_page = pagedquery.page_count() entries = pagedquery.fetch_page(page) ptags = Tag.popular_tags(limit=10) if not entries: if not self.current_user or self.current_user.administrator: self.redirect("/compose") return self.render("home.html", entries=entries, ptags=ptags, page=page, last_page=last_page)
def get(self): ptags = Tag.popular_tags(limit=10) self.render("about.html", ptags=ptags)
def get(self, name): tag = Tag.get_by_name(name) entries = Entry.all().filter("__key__ IN", tag.tagged) self.render("taglist.html", name=name, entries=entries)
def get(self, slug): entry = db.Query(Entry).filter("slug =", slug).get() ptags = Tag.popular_tags(limit=10) if not entry: raise tornado.web.HTTPError(404) self.render("entry.html", entry=entry, ptags=ptags)