-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.py
31 lines (22 loc) · 997 Bytes
/
category.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from google.appengine.ext.webapp import template
import wsgiref.handlers
import cgi
import models
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext import webapp
class Category(webapp.RequestHandler):
def get(self):
category=cgi.escape(self.request.get('category'))
govapps = db.GqlQuery('SELECT * FROM App WHERE gov = True AND category = :1 AND status = :2 ORDER BY rating DESC', category, "Approved")
nongovapps = db.GqlQuery('SELECT * FROM App WHERE gov = FALSE AND category = :1 AND status = :2 ORDER BY rating DESC', category, "Approved")
template_values = {
'govapps':govapps,
'nongovapps':nongovapps,
'category':category,
}
path = os.path.join(os.path.dirname(__file__), 'category.html')
self.response.out.write(template.render(path, template_values))