75bbba852079a3f462decf3ee857aa9a0c08339f
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 # Return a rendered template
17 #return render('/search.mako')
18 # or, return a response
22 """ Search, implemented the stupid way! """
23 query
= request
.params
.get('query','')
26 tagtexts
= TagText
.query
.filter(TagText
.text
.in_(tags
))
27 tagtext_ids
= [_
.id for _
in tagtexts
]
29 # Fetch art that has all the tags
30 c
.artwork
= Art
.query
.join(Tag
) \
31 .filter(Tag
.id.in_(tagtext_ids
)) \
34 return render('/index.mako')