Example #1
0
def listranking(format='json'):
    ranks = []
    for x in db.findRanking():
        if format == "json":
            ranks.append(x)
        else:
            ranks.append(x['cpe'] + " " + str(x['rank']))
    return ranks
Example #2
0
def listranking(format="json"):
    ranks = []
    for x in db.findRanking():
        if format == "json":
            ranks.append(x)
        else:
            ranks.append(x["cpe"] + " " + str(x["rank"]))
    return ranks
Example #3
0
def listranking(format='json'):
    ranks = []
    for x in db.findRanking():
        if format == "json":
            ranks.append(x)
        else:
            ranks.append(x['cpe'] + " " + str(x['rank']))
    return ranks
Example #4
0
def findranking(cpe=None, loosy=True):
    if cpe is None:
        return False
    result = False
    if loosy:
        for x in cpe.split(":"):
            if x is not "":
                i = db.findRanking(cpe)
            if i is None:
                continue
            if "rank" in i:
                result = i["rank"]
    else:
        i = db.findRanking(cpe)
        print(cpe)
        if i is None:
            return result
        if "rank" in i:
            result = i["rank"]
    return result
Example #5
0
def findranking(cpe=None, loosy=True):
    if cpe is None:
        return False
    result = False
    if loosy:
        for x in cpe.split(':'):
            if x is not '':
                i = db.findRanking(cpe, regex=True)
            if i is None:
                continue
            if 'rank' in i:
                result = i['rank']
    else:
        i = db.findRanking(cpe, regex=True)
        print(cpe)
        if i is None:
            return result
        if 'rank' in i:
            result = i['rank']
    return result
Example #6
0
def findranking(cpe=None, loosy=True):
  if cpe is None:
    return False
  result = False
  if loosy:
    for x in cpe.split(':'):
      if x is not '':
        i = db.findRanking(cpe, regex=True)
      if i is None:
        continue
      if 'rank' in i:
        result = i['rank']
  else:
    i = db.findRanking(cpe, regex=True)
    print (cpe)
    if i is None:
      return result
    if 'rank' in i:
      result = i['rank']
  return result
Example #7
0
    def getranking(self, cpeid=None, loosy=True):

        if cpeid is None:
            return False

        result = False

        if loosy:
            for x in cpeid.split(':'):
                if x is not '':
                    i = db.findRanking(x, regex=True)
                if i is None:
                    continue
                if 'rank' in i:
                    result = i['rank']
        else:
            i = db.findRanking(cpeid, regex=True)
            if i is None:
                return result
            if 'rank' in i:
                result = i['rank']

        return result
Example #8
0
    def getranking(self, cpeid=None, loosy=True):

        if cpeid is None:
            return False

        result = False

        if loosy:
            for x in cpeid.split(':'):
                if x is not '':
                    i = db.findRanking(x, regex=True)
                if i is None:
                    continue
                if 'rank' in i:
                    result = i['rank']
        else:
            i = db.findRanking(cpeid, regex=True)
            if i is None:
                return result
            if 'rank' in i:
                result = i['rank']

        return result
Example #9
0
def findranking(cpe=None, loosy=True):
    i = None

    if cpe is None:
        return False

    result = False

    if loosy:
        for x in cpe.split(":"):
            if x is not "":
                i = db.findRanking(cpe, regex=True)
            if i is None:
                continue
            if "rank" in i:
                result = i["rank"]
    else:
        i = db.findRanking(cpe, regex=True)
        print(cpe)
        if i is None:
            return result
        if "rank" in i:
            result = i["rank"]
    return result