Rev 49 |
Rev 89 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tornado.database
import re
def getnavilist():
ret = []
current = u""
db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi")
for row in db.query("""
SELECT *, CHAR_LENGTH(navi) AS NL
FROM `metaWords`
ORDER BY NL DESC"""):
if row["infixes"]:
ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"], "type": row["partOfSpeech"]})
else:
ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"], "type": row["partOfSpeech"]})
db.close()
return ret
def getnavi(word):
ret = []
db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi")
for row in db.query("""
SELECT *
FROM `metaWords`
WHERE navi = ?""",word):
if row["infixes"]:
ret.append({"id": row["id"], "navi": row["navi"], "infix": row["infixes"], "type": row["partOfSpeech"]})
else:
ret.append({"id": row["id"], "navi": row["navi"], "infix": row["navi"], "type": row["partOfSpeech"]})
db.close()
return ret
#def gettrans(id, cod):
#ret = []
#if cod not in (u"est",u"ptbr",u"de",u"eng",u"all"):
#return ret
#db = tornado.database.Connection("127.0.0.1", "navi", user="navi", password="navi")
#if cod == "all":
#for row in db.query("""
#SELECT *
#FROM `metaWords`
#WHERE id = ?""",idd):
#infix = makeinfix(row)
#ret.append([row["id"],row["navi"], infix, row["partOfSpeech"]])
#db.close()