views.py
def insertLabelsOnIdDB():
    """This function allows to add a new label"""
    global count12
    if request.is_xhr and request.method=="POST":
        try:
            count1 = managedb.getCountLoginDB(session["username"])
            if count1 == 0:
                return json.dumps({"result": "exit"})
            count12 = managedb.countLabelDB()
        except Exception as e:
            print("exception error DB", str(e))
        l = request.form["label"]
        label = {"labelName":l.upper(),"labelId":count12}
        print("Label da inserire,",l.upper(), "labelId",count12)
        try:
            result,id = managedb.insertLabelDB(label)
            if result == True:
                print("label id:", str(id))
                count12 += 1
                return json.dumps({"result": "correct"})
            else:
                return json.dumps({"result": "alreadyinserted"})
        except Exception as e:
            print("exception error DB", str(e))
            return json.dumps({"result": "error"})
This function allows to add a new label
This function allows to add a new label
This function allows to add a new label
def insertLabelsOnIdDB():
    global count12
    if request.is_xhr and request.method=="POST":
        try:
            count1 = managedb.getCountLoginDB(session["username"])
            if count1 == 0:
                return json.dumps({"result": "exit"})
            count12 = managedb.countLabelDB()
        except Exception as e:
            print("exception error DB", str(e))
        l = request.form["label"]
        label = {"labelName":l.upper(),"labelId":count12}
        print("Label da inserire,",l.upper(), "labelId",count12)
        try:
            result,id = managedb.insertLabelDB(label)
            if result == True:
                print("label id:", str(id))
                count12 += 1
                return json.dumps({"result": "correct"})
            else:
                return json.dumps({"result": "alreadyinserted"})
        except Exception as e:
            print("exception error DB", str(e))
            return json.dumps({"result": "error"})
def insertLabelsOnIdDB ( ) : global count12 if request . is_xhr and request . method == "POST" : try : count1 = managedb . getCountLoginDB ( session [ "username" ] ) if count1 == 0 : return json . dumps ( { "result" : "exit" } ) count12 = managedb . countLabelDB ( ) except Exception as e : print ( "exception error DB" , str ( e ) ) l = request . form [ "label" ] label = { "labelName" : l . upper ( ) , "labelId" : count12 } print ( "Label da inserire," , l . upper ( ) , "labelId" , count12 ) try : result , id = managedb . insertLabelDB ( label ) if result == True : print ( "label id:" , str ( id ) ) count12 += 1 return json . dumps ( { "result" : "correct" } ) else : return json . dumps ( { "result" : "alreadyinserted" } ) except Exception as e : print ( "exception error DB" , str ( e ) ) return json . dumps ( { "result" : "error" } )
This function allows to add a new label
This function allows to add a new label
"""This function allows to add a new label"""