Ejemplo n.º 1
0
    def index(self, search = None):
        if search:
            q = quotes.select().order_by('id').where('body LIKE "%{0}%"'.format(search))
        else:
            q = quotes.select().order_by('id')
        rs = q.execute()
        rows = rs.fetchall()
        to_ret = []

        for r in rows:
            to_ret.append((r[0], linkify(r[1])))

        template = env.get_template("search.jinja2")
        return template.render(results=to_ret)
Ejemplo n.º 2
0
    def index(self, search=None):
        if search:
            q = quotes.select().order_by('id').where(
                'body LIKE "%{0}%"'.format(search))
        else:
            q = quotes.select().order_by('id')
        rs = q.execute()
        rows = rs.fetchall()
        to_ret = []

        for r in rows:
            to_ret.append((r[0], linkify(r[1])))

        template = env.get_template("search.jinja2")
        return template.render(results=to_ret)
Ejemplo n.º 3
0
 def get_by_id(self, quoteId):
     q =  quotes.select().where('id=' + str(quoteId))
     rs = q.execute()
     row = rs.fetchone()
     return row
Ejemplo n.º 4
0
 def search(self, message):
     q = quotes.select().order_by('id').where('body LIKE "%{0}%"'.format(message))
     rs = q.execute()
     rows = rs.fetchall()
     return rows
Ejemplo n.º 5
0
 def get_random(self):
     q =  quotes.select(limit=1).order_by('RANDOM()')
     rs = q.execute()
     row = rs.fetchone()
     return row
Ejemplo n.º 6
0
 def get_by_id(self, quoteId):
     q = quotes.select().where("id=" + str(quoteId))
     rs = q.execute()
     row = rs.fetchone()
     return row
Ejemplo n.º 7
0
 def search(self, message):
     q = quotes.select().order_by("id").where('body LIKE "%{0}%"'.format(message))
     rs = q.execute()
     rows = rs.fetchall()
     return rows
Ejemplo n.º 8
0
 def get_random(self):
     q = quotes.select(limit=1).order_by("RANDOM()")
     rs = q.execute()
     row = rs.fetchone()
     return row
Ejemplo n.º 9
0
 def search(self, message):
     print "Search string: "+ message
     q = quotes.select().order_by('id').where('body LIKE "%'+message+'%"')
     rs = q.execute()
     rows = rs.fetchall()
     return rows