Subversion Repositories navi

Rev

Rev 144 | Rev 176 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
46 szabot 1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
 
4
import tornado.database
5
import re
6
 
7
def getnavilist():
8
    ret = []
9
    current = u""
10
    db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi")
11
    for row in db.query("""
103 szabot 12
    SELECT *
46 szabot 13
    FROM `metaWords`
103 szabot 14
    WHERE partOfSpeech <> 'num.' AND partOfSpeech <> "prefix"
15
    ORDER BY CHAR_LENGTH(navi) DESC"""):
65 szabot 16
        if row["infixes"]:
89 szabot 17
            ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"].lower(), "type": row["partOfSpeech"]})
65 szabot 18
        else:
89 szabot 19
            ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"].lower(), "type": row["partOfSpeech"]})
46 szabot 20
    db.close()
21
    return ret
22
 
142 szabot 23
def translate(wid,language):
136 muzer 24
    db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi")
25
    for row in db.query("""
26
    SELECT *
27
    FROM `localizedWords`
145 szabot 28
    WHERE id = %s AND languageCode = %s""",wid,language):
136 muzer 29
        ret = row["localized"]
139 szabot 30
        break
136 muzer 31
    db.close()
145 szabot 32
    return ret