86179666e5310cd1706414c334293c4d65be8748
3 from pylons
import request
, response
, session
, tmpl_context
as c
4 from pylons
.controllers
.util
import abort
, redirect
7 from floof
.lib
import helpers
as h
8 from floof
.lib
.base
import BaseController
, render
9 from floof
.lib
.tags
import parse
11 log
= logging
.getLogger(__name__
)
13 from floof
.model
import Art
, Tag
, TagText
14 from floof
.model
import SavedSearch
, GalleryWidget
17 class SearchController(BaseController
):
20 if request
.params
.get('button') == 'Save':
23 c
.query
= request
.params
.get('query', '')
24 c
.artwork
= parse(c
.query
).all()
25 return render('/index.mako')
27 # TODO: login required
29 c
.query
= request
.params
.get('query', '')
30 saved_search
= SavedSearch(author
=c
.user
, string
=c
.query
)
31 elixir
.session
.commit()
32 redirect(url('saved_searches'))
33 # TODO: do something better than this.
36 # TODO: login required
38 c
.searches
= c
.user
.searches
39 return render('/searches.mako')
41 # TODO: login required
42 def display(self
, id):
43 c
.search
= h
.get_object_or_404(SavedSearch
, id=id)
44 c
.gallery
= GalleryWidget(search
=c
.search
, page
=c
.user
.primary_page
)
45 elixir
.session
.commit()
46 redirect(url(controller
="users", action
="view", name
=c
.user
.name
))