Example #1
0
    def pesquisaUrlPelaUrl(self, url):
        conn = Conexao()
        db = conn.recebeConexao()
        cursor = db.cursor()
        cursor.execute("SELECT * from Url WHERE urlCaminho = %s", (url))
        retorno = cursor.fetchone()
        url = ModelUrl()
        if (retorno != None):
            url.IdUrl = retorno[0]
            url.UrlCaminho = retorno[1]
            if (str(retorno[2]) != None):
                url.IdUrlPai = retorno[2]
            else:
                url.IdUrlPai = None
            url.NivelRecursividade = retorno[3]
            url.DataCadastro = retorno[4]
            if (str(retorno[5]) == "1"):
                url.SeBase = True
            else:
                url.SeBase = False
        else:
            url = None

        db.close()
        return url
Example #2
0
def InsertUrl(urlSon, urlFather):
    dUrl = DaoUrl()
    m = ModelUrl()
    if (urlFather == None):
        m.IdUrlPai = None
        m.SeBase = True
    else:
        mUrlFather = dUrl.pesquisaUrlPelaUrl(urlFather)
        m.IdUrlPai = mUrlFather.IdUrl
        m.SeBase = False
    m.IdUrl = str(uuid1())
    m.DataCadastro = time.strftime("%Y-%m-%d")
    global NivelRecursividade
    m.NivelRecursividade = NivelRecursividade
    m.UrlCaminho = urlSon
    dUrl.insertUrl(m)
Example #3
0
def InsertUrl(urlSon, urlFather):
    dUrl = DaoUrl()
    m = ModelUrl()
    if (urlFather == None):
        m.IdUrlPai = None
        m.SeBase = True
    else:
        mUrlFather = dUrl.pesquisaUrlPelaUrl(urlFather)
        m.IdUrlPai = mUrlFather.IdUrl
        m.SeBase = False
    m.IdUrl = str(uuid1())
    m.DataCadastro = time.strftime("%Y-%m-%d")
    global NivelRecursividade
    m.NivelRecursividade = NivelRecursividade
    m.UrlCaminho = urlSon
    dUrl.insertUrl(m)