Esempio n. 1
0
  def get(self):
    req = self.request

    count = int(req.get('count', 75))
    if count > 100:
      count = 100

    q = MemeTemplate.all()
    q.order('-last_used')
    cursor = req.get('cursor')
    if cursor:
      q.with_cursor(cursor)

    templates = []
    for template in q.run(limit=count):
      template_data = Expando({
        'name': template.name,
        'width': template.width,
        'height': template.height
      })
      templates.append(template_data)

    sorted_templates = sorted(templates[:], sort_templates)

    html = template_helper.render('view_templates.html',
      templates=templates,
      alpha_sorted_templates=sorted_templates,
      cursor=q.cursor)
    self.response.write(html)