abedd16ff6ea9556c59bda6ac420db4591ad1c58
3 from pylons
import request
, response
, session
, tmpl_context
as c
4 from pylons
.controllers
.util
import abort
, redirect_to
6 from floof
.lib
.base
import BaseController
, render
8 log
= logging
.getLogger(__name__
)
10 from floof
.model
.art
import Art
, Tag
, TagText
13 class SearchController(BaseController
):
16 """Search, implemented the stupid way!"""
17 query
= request
.params
.get('query', '')
20 tagtexts
= TagText
.query
.filter(TagText
.text
.in_(tags
))
21 tagtext_ids
= [_
.id for _
in tagtexts
]
23 # Fetch art that has all the tags
24 c
.artwork
= Art
.query
.join(Tag
) \
25 .filter(Tag
.tagtext_id
.in_(tagtext_ids
)) \
28 return render('/index.mako')