Kang-min Wang avatar Kang-min Wang committed a807ce8

add search conference list function

Comments (0)

Files changed (1)

 from django.utils import simplejson
 
 
-class GetConfInfo(  webapp.RequestHandler ):
+class GetConfInfo( webapp.RequestHandler ):
     """
     Get conference joke information
     """
 
         self.response.out.write(simplejson.dumps(output))
 
+
+class SearchConferenceList( webapp.RequestHandler ):
+    """
+    Search conference name by keyword, if no keyword then list all conference
+    """
+    def get(self):
+        keyword = cgi.escape( self.request.get('keyword') )
+        query = model.Conference.all()
+        #if had keyword
+        if len( keyword ):
+            query.filter('name >=', keyword)
+        query.fetch(1000)
+
+        output = []
+        for conf_list in query:
+            output.append(
+                {'name': conf_list.name,
+                 'desc': conf_list.desc})
+
+        self.response.out.write(simplejson.dumps( output ))
+
 def main():
     application = webapp.WSGIApplication([
-                        ('/API/GetConfInfo', GetConfInfo)],
+                        ('/API/GetConfInfo', GetConfInfo),
+                        ('/API/SearchConfList',SearchConferenceList)],
                         debug=True)
     util.run_wsgi_app(application)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.