Exemplo n.º 1
0
def getNames():
    namesq = Name.gql("WHERE numRankings =:1", None)
    names = []
    for name in namesq:
        _name = {"name": name.name, "id": name.key().id()}
        names.append(_name)
    return names
Exemplo n.º 2
0
def registerName(name, taxonomicRankLevel):
    if Name.gql("WHERE name = :1", name).count() > 0:
        raise BaseError, "Name is already registered"
    tn = Name()
    tn.name = name
    tn.numRankings = 0
    tn.taxonomicRankLevel = taxonomicRankLevel
    tn.put()
    return tn.key().id()
Exemplo n.º 3
0
def voteImage(name, url):
    q = Name.gql("WHERE name = :1", name)
    _name = q.get()
    if _name < 1:
        raise BaseError, "Name does not exist in database!"

    _name.preferedImageURL = url
    _name.numRankings = 1
    _name.put()
    return True
Exemplo n.º 4
0
def getName():
    namesq = Name.gql("WHERE numRankings =:1 LIMIT 1", None)
    for name in namesq:
        _name = {"name": name.name, "id": name.key().id()}
        return _name