4e92a6da793c3f61b7a0e655d5ca3f44bdbcda26
3 from pylons
import request
, response
, session
, tmpl_context
as c
, h
4 from pylons
.controllers
.util
import abort
, redirect
7 from floof
.lib
.base
import BaseController
, render
8 from floof
.lib
.search
import do_search
10 log
= logging
.getLogger(__name__
)
12 from floof
.model
.art
import Art
, Tag
, TagText
13 from floof
.model
.search
import SavedSearch
, GalleryWidget
16 class SearchController(BaseController
):
19 if request
.params
.get('button') == 'Save':
22 c
.query
= request
.params
.get('query', '')
23 c
.artwork
= do_search(c
.query
)
24 return render('/index.mako')
26 # TODO: login required
28 c
.query
= request
.params
.get('query', '')
29 saved_search
= SavedSearch(author
=c
.user
, string
=c
.query
)
30 elixir
.session
.commit()
31 redirect(url('saved_searches'))
32 # TODO: do something better than this.
35 # TODO: login required
37 c
.searches
= c
.user
.searches
38 return render('/searches.mako')
40 # TODO: login required
41 def display(self
, id):
42 c
.search
= h
.get_object_or_404(SavedSearch
, id=id)
43 c
.gallery
= GalleryWidget(search
=c
.search
, page
=c
.user
.primary_page
)
44 elixir
.session
.commit()
45 redirect(url(controller
="users", action
="view", name
=c
.user
.name
))