Ejemplo n.º 1
0
def getSearchString(searchStringID):
    """Récupère une règle dans la base"""
    db = dbUtils.createConnexion()
    myvar = {"id":searchStringID}
    checkExisting = db.select('searchstrings',myvar, where="id=$id")
    try:
        searchString = checkExisting[0]
        categoryID = searchString["categoryID"]
        searchString["category"] = category.getCategory(categoryID)["category"]
        return searchString
    except IndexError:
        print "Règle %s est introuvable!" % searchStringID
        return -1
Ejemplo n.º 2
0
def getAllSearchStrings():
    """Retourne tous les cas de catégorisation automatique"""
    db = dbUtils.createConnexion()
    allSearchStrings = db.select('searchStrings')
    searchStrings = {}
    for mySearch in allSearchStrings:
        searchString = {}
        searchString["id"]=mySearch["id"]
        searchString["searchString"]=mySearch["searchString"]
        searchString["categoryID"]=mySearch["categoryID"]
        searchString["category"]=category.getCategory(int(searchString["categoryID"]))["category"]
        searchStrings[searchString["id"]]=searchString
    return searchStrings
Ejemplo n.º 3
0
def getTransaction(transactionID):
    """Récupère une transaction dans la base"""
    db = dbUtils.createConnexion()
    myvar = {"id": transactionID}
    checkExisting = db.select("transactions", myvar, where="id=$id")
    try:
        transaction = checkExisting[0]
        categoryID = transaction["categoryID"]
        transaction["category"] = category.getCategory(categoryID)["category"]
        return transaction
    except IndexError:
        print "Transaction %s est introuvable!" % transactionID
        return -1
Ejemplo n.º 4
0
def cmdCommandCategory(account, params, r):
	"""
		# help
		% get category of a specific command
		% format: .commandcategory <cmd>
	"""
	if len(params)==0:
		r.l("!bad argument")
		return
	from category import getCategory
	c, d = getCategory(params)
	if c is None:
		r.l("!command not found")
		return

	r.l( ("category", d) )