def loadSTR(str,lang):
    Hypertable=HypertableConnection()
    str = base64.b64encode(str)
    results=Hypertable.query("SELECT txt:'"+ lang +"' FROM TRANSLATIONS WHERE ROW='" + str + "' CELL_LIMIT 1")
    if len(results.cells) > 0:
        return base64.b64decode(results.cells[0].value)
    return False
def getCountry():
    ip = web.ctx.env.get('REMOTE_ADDR')
    Hypertable=HypertableConnection()
    results=Hypertable.query("SELECT G FROM TEMP WHERE ROW='" + ip + "' CELL_LIMIT 1")
    if len(results.cells) > 0:
        return results.cells[0].value
    country = getCountryFromIP(ip)
    storeGeoip(ip,country)
    return country
def storeSTR(str,lang,txt):
    str = base64.b64encode(str)
    txt = base64.b64encode(txt)
    Hypertable=HypertableConnection()
    Hypertable.insert('TRANSLATIONS', str, "txt:"+lang, txt)
def deleteSTR(str,lang):
    Hypertable=HypertableConnection()
    str = base64.b64encode(str)
    Hypertable.query("DELETE txt:'"+ lang +"' FROM TRANSLATIONS WHERE ROW='" + str + "'")
def storeGeoip(ip,country):
    if country is not None:
     Hypertable=HypertableConnection()
     Hypertable.insert('TEMP', ip, "G", country)