def get(self): self.response.headers['Content-Type'] = 'text/html' seeds = Seed.query(Seed.hidden != True) out = '<html><head><title>All Plando Authors</title></head><body><h5>All Seeds</h5><ul style="list-style-type:none;padding:5px">' authors = Counter([seed.author for seed in seeds]) for author, cnt in authors.most_common(): if cnt > 0: url = "%s/plando/%s" % (base_site, author) out += '<li style="padding:2px"><a href="%s">%s</a> (%s plandos)</li>' % ( url, author, cnt) out += "</ul></body></html>" self.response.out.write(out)
def get(self, author): self.response.headers['Content-Type'] = 'text/html' owner = False user = users.get_current_user() if user: dispname = user.email().partition("@")[0] owner = dispname == author query = Seed.query(Seed.author == author) if not owner: query = query.filter(Seed.hidden != True) seeds = query.fetch() if len(seeds): out = '<html><head><title>Seeds by %s</title></head><body><div>Seeds by %s:</div><ul style="list-style-type:none;padding:5px">' % ( author, author) for seed in seeds: url = "%s/plando/%s/%s" % (base_site, author, seed.name) flags = ",".join(seed.flags) out += '<li style="padding:2px"><a href="%s">%s</a>: %s (%s players, %s)' % ( url, seed.name, seed.description, seed.players, flags) if owner: out += ' <a href="%s/edit">Edit</a>' % url if seed.hidden: out += " (hidden)" out += "</li>" out += "</ul></body></html>" self.response.write(out) else: if owner: self.response.write( "<html><body>You haven't made any seeds yet! <a href='/plando/%s/newseed/edit'>Start a new seed</a></body></html>" % author) else: self.response.write( '<html><body>No seeds by user %s</body></html>' % author)