Make search a GET to /search.
authorEevee <git@veekun.com>
Mon, 5 Oct 2009 02:17:44 +0000 (19:17 -0700)
committerEevee <git@veekun.com>
Mon, 5 Oct 2009 02:21:00 +0000 (19:21 -0700)
floof/config/routing.py
floof/controllers/search.py
floof/templates/base.mako

index f78246a..03edbeb 100644 (file)
@@ -26,6 +26,8 @@ def make_map():
     map.connect('/account/login_begin', controller='account', action='login_begin', **require_POST)
     map.connect('/account/login_finish', controller='account', action='login_finish')
 
     map.connect('/account/login_begin', controller='account', action='login_begin', **require_POST)
     map.connect('/account/login_finish', controller='account', action='login_finish')
 
+    map.connect('/search', controller='search', action='index')
+
     map.connect('/{controller}/{action}')
     map.connect('/{controller}/{action}/{id}')
 
     map.connect('/{controller}/{action}')
     map.connect('/{controller}/{action}/{id}')
 
index 75bbba8..88dfbe3 100644 (file)
@@ -13,14 +13,8 @@ import elixir
 class SearchController(BaseController):
 
     def index(self):
 class SearchController(BaseController):
 
     def index(self):
-        # Return a rendered template
-        #return render('/search.mako')
-        # or, return a response
-        return 'Hello World'
-
-    def results(self):
-        """ Search, implemented the stupid way! """
-        query = request.params.get('query','')
+        """Search, implemented the stupid way!"""
+        query = request.params.get('query', '')
         tags = query.split()
 
         tagtexts = TagText.query.filter(TagText.text.in_(tags))
         tags = query.split()
 
         tagtexts = TagText.query.filter(TagText.text.in_(tags))
index 19f8455..e36f3ea 100644 (file)
@@ -10,8 +10,8 @@
 <div id="header">
 <a href="${h.url_for("/")}">Home</a>
 
 <div id="header">
 <a href="${h.url_for("/")}">Home</a>
 
-${h.form (h.url_for(controller="search", action="results"))}
-${h.text('query')} ${h.submit('search','Search')}
+${h.form(h.url_for(controller='search'), method='GET')}
+${h.text('query')} ${h.submit(None, 'Search')}
 ${h.end_form()}
 
     <div id="user">
 ${h.end_form()}
 
     <div id="user">