Example #1
0
def guess_agegroup(dbo, s):
    """ Guesses an agegroup, returns the default if no match is found """
    s = str(s).lower()
    guess = db.query_string(
        dbo,
        "SELECT ItemValue FROM configuration WHERE ItemName LIKE 'AgeGroup%Name' AND LOWER(ItemValue) LIKE '%"
        + db.escape(s) + "%'")
    if guess != "": return guess
    return db.query_string(
        dbo,
        "SELECT ItemValue FROM configuration WHERE ItemName LIKE 'AgeGroup2Name'"
    )
Example #2
0
def get_file(dbo, name, path, saveto):
    """
    Gets DBFS file contents and saves them to the
    filename given. Returns True for success
    """
    if path != "":
        s = db.query_string(dbo, "SELECT Content FROM dbfs WHERE Name = '%s' AND Path = '%s'" % (name, path))
    else:
        s = db.query_string(dbo, "SELECT Content FROM dbfs WHERE Name = '%s'" % name)
    if s != "":
        f = open(saveto, "wb")
        f.write(base64.b64decode(s))
        f.close()
        return True
    return False
Example #3
0
File: media.py Project: magul/asm3
def check_and_scale_pdfs(dbo, force = False):
    """
    Goes through all PDFs in the database to see if they have been
    scaled (have a suffix of _scaled.pdf) and scales down any unscaled
    ones.
    If force is set, then all PDFs are checked and scaled again even
    if they've been scaled before.
    """
    if not configuration.scale_pdfs(dbo):
        al.warn("ScalePDFs config option disabled in this database, not scaling pdfs", "media.check_and_scale_pdfs", dbo)
        return
    if force:
        mp = db.query(dbo, \
            "SELECT ID, MediaName FROM media WHERE LOWER(MediaName) LIKE '%.pdf' ORDER BY ID DESC")
    else:
        mp = db.query(dbo, \
            "SELECT ID, MediaName FROM media WHERE LOWER(MediaName) LIKE '%.pdf' AND " \
            "LOWER(MediaName) NOT LIKE '%_scaled.pdf' ORDER BY ID DESC")
    for i, m in enumerate(mp):
        filepath = db.query_string(dbo, "SELECT Path FROM dbfs WHERE Name='%s'" % m["MEDIANAME"])
        original_name = str(m["MEDIANAME"])
        new_name = str(m["ID"]) + "_scaled.pdf"
        odata = dbfs.get_string(dbo, original_name)
        data = scale_pdf(odata)
        al.debug("scaling %s (%d of %d): old size %d, new size %d" % (new_name, i, len(mp), len(odata), len(data)), "check_and_scale_pdfs", dbo)
        # Update the media entry with the new name
        db.execute(dbo, "UPDATE media SET MediaName = '%s' WHERE ID = %d" % ( new_name, m["ID"]))
        # Update the dbfs entry from old name to new name (will be overwritten in a minute but safer than delete)
        dbfs.rename_file(dbo, filepath, original_name, new_name)
        # Store the PDF file data with the new name - if there was a need to change it
        if len(data) < len(odata):
            dbfs.put_string(dbo, new_name, filepath, data)
    al.debug("found and scaled %d pdfs" % len(mp), "media.check_and_scale_pdfs", dbo)
Example #4
0
def scale_animal_images(dbo):
    """
    Goes through all animal images in the database and scales
    them to the current incoming media scaling factor.
    """
    mp = db.query(dbo, "SELECT MediaName FROM media WHERE LOWER(MediaName) LIKE '%.jpg' AND LinkTypeID = 0")
    for i, m in enumerate(mp):
        filepath = db.query_string(dbo, "SELECT Path FROM dbfs WHERE Name='%s'" % m["MEDIANAME"])
        name = str(m["MEDIANAME"])
        inputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        outputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        odata = dbfs.get_string(dbo, name)
        inputfile.write(odata)
        inputfile.flush()
        inputfile.close()
        outputfile.close()
        al.debug("scaling %s (%d of %d)" % (name, i, len(mp)), "media.scale_animal_images", dbo)
        scale_image_file(inputfile.name, outputfile.name, configuration.incoming_media_scaling(dbo))
        f = open(outputfile.name, "r")
        data = f.read()
        f.close()
        os.unlink(inputfile.name)
        os.unlink(outputfile.name)
        # Update the image file data
        dbfs.put_string(dbo, name, filepath, data)
    al.debug("scaled %d images" % len(mp), "media.scale_animal_images", dbo)
Example #5
0
def check_and_scale_pdfs(dbo):
    """
    Goes through all PDFs in the database to see if they have been
    scaled (have a suffix of _scaled.pdf) and scales down any unscaled
    ones.
    """
    if not SCALE_PDF_DURING_BATCH:
        al.warn("SCALE_PDF_DURING_BATCH is disabled, not scaling pdfs",
                "media.check_and_scale_pdfs", dbo)
    if not configuration.scale_pdfs(dbo):
        al.warn(
            "ScalePDFs config option disabled in this database, not scaling pdfs",
            "media.check_and_scale_pdfs", dbo)
    mp = db.query(dbo, \
        "SELECT MediaName FROM media WHERE LOWER(MediaName) LIKE '%.pdf' AND " \
        "LOWER(MediaName) NOT LIKE '%_scaled.pdf'")
    for m in mp:
        filepath = db.query_string(
            dbo, "SELECT Path FROM dbfs WHERE Name='%s'" % m["MEDIANAME"])
        original_name = str(m["MEDIANAME"])
        new_name = str(m["MEDIANAME"])
        new_name = new_name[0:len(new_name) - 4] + "_scaled.pdf"
        odata = dbfs.get_string(dbo, original_name)
        data = scale_pdf(odata)
        # Update the media entry with the new name
        db.execute(dbo, "UPDATE media SET MediaName = '%s' WHERE MediaName = '%s'" % \
            ( new_name, original_name))
        # Update the dbfs entry with the new name
        dbfs.rename_file(dbo, filepath, original_name, new_name)
        # Update the PDF file data
        dbfs.put_string(dbo, new_name, filepath, data)
    al.debug("found and scaled %d pdfs" % len(mp),
             "media.check_and_scale_pdfs", dbo)
Example #6
0
def scale_animal_images(dbo):
    """
    Goes through all animal images in the database and scales
    them to the current incoming media scaling factor.
    """
    mp = db.query(
        dbo,
        "SELECT MediaName FROM media WHERE LOWER(MediaName) LIKE '%.jpg' AND LinkTypeID = 0"
    )
    for i, m in enumerate(mp):
        filepath = db.query_string(
            dbo, "SELECT Path FROM dbfs WHERE Name='%s'" % m["MEDIANAME"])
        name = str(m["MEDIANAME"])
        inputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        outputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        odata = dbfs.get_string(dbo, name)
        inputfile.write(odata)
        inputfile.flush()
        inputfile.close()
        outputfile.close()
        al.debug("scaling %s (%d of %d)" % (name, i, len(mp)),
                 "media.scale_animal_images", dbo)
        scale_image_file(inputfile.name, outputfile.name,
                         configuration.incoming_media_scaling(dbo))
        f = open(outputfile.name, "r")
        data = f.read()
        f.close()
        os.unlink(inputfile.name)
        os.unlink(outputfile.name)
        # Update the image file data
        dbfs.put_string(dbo, name, filepath, data)
    al.debug("scaled %d images" % len(mp), "media.scale_animal_images", dbo)
Example #7
0
def get_location_filter(dbo, user):
    """
    Returns the location filter (comma separated list of IDs) 
    for a user, or "" if it doesn't have one.
    """
    return db.query_string(
        dbo,
        "SELECT LocationFilter FROM users WHERE UserName LIKE '%s'" % user)
def get_found_person_name(dbo, aid):
    """
    Returns the contact name for a found animal
    """
    return db.query_string(
        dbo,
        "SELECT o.OwnerName FROM animalfound a INNER JOIN owner o ON a.OwnerID = o.ID WHERE a.ID = %d"
        % int(aid))
Example #9
0
File: users.py Project: magul/asm3
def get_theme_override(dbo, username):
    """
    Returns a user's theme override, or empty string if it doesn't have one
    """
    try:
        return db.query_string(dbo, "SELECT ThemeOverride FROM users WHERE UserName Like '%s'" % username)
    except:
        return ""
Example #10
0
def get_person_name(dbo, wid):
    """
    Returns the contact name for the waitinglist with id
    """
    return db.query_string(
        dbo,
        "SELECT o.OwnerName FROM animalwaitinglist a INNER JOIN owner o ON a.OwnerID = o.ID WHERE a.ID = %d"
        % int(wid))
Example #11
0
def get_onlineformincoming_formfooter(dbo, collationid):
    """
    Given a collation id for an incoming form, try and find the
    original onlineform footer.
    """
    return db.query_string(dbo, "SELECT o.Footer FROM onlineform o " \
        "INNER JOIN onlineformincoming oi ON oi.FormName = o.Name " \
        "WHERE oi.CollationID = %d" % int(collationid))
Example #12
0
def get_file(dbo, name, path, saveto):
    """
    Gets DBFS file contents and saves them to the
    filename given. Returns True for success
    """
    if path != "":
        s = db.query_string(
            dbo, "SELECT Content FROM dbfs WHERE Name = '%s' AND Path = '%s'" %
            (name, path))
    else:
        s = db.query_string(
            dbo, "SELECT Content FROM dbfs WHERE Name = '%s'" % name)
    if s != "":
        f = open(saveto, "wb")
        f.write(base64.b64decode(s))
        f.close()
        return True
    return False
Example #13
0
def get_theme_override(dbo, username):
    """
    Returns a user's theme override, or empty string if it doesn't have one
    """
    try:
        return db.query_string(
            dbo, "SELECT ThemeOverride FROM users WHERE UserName Like '%s'" %
            username)
    except:
        return ""
Example #14
0
def insert_onlineformincoming_from_form(dbo, post, remoteip):
    """
    Create onlineformincoming records from posted data. We 
    create a row for every key/value pair in the posted data
    with a unique collation ID.
    """
    IGNORE_FIELDS = [ "formname", "flags", "redirect", "account", "filechooser", "method" ]
    collationid = db.query_int(dbo, "SELECT MAX(CollationID) FROM onlineformincoming") + 1
    formname = post["formname"]
    posteddate = i18n.now(dbo.timezone)
    flags = post["flags"]
    for k, v in post.data.iteritems():
        if k not in IGNORE_FIELDS:
            label = ""
            displayindex = 0
            fieldname = k
            # Form fields should have a _ONLINEFORMFIELD.ID suffix we can use to get the
            # original label and display position
            if k.find("_") != -1:
                fid = utils.cint(k[k.rfind("_")+1:])
                fieldname = k[0:k.rfind("_")]
                if fid != 0:
                    fld = db.query(dbo, "SELECT Label, DisplayIndex FROM onlineformfield WHERE ID = %d" % fid)
                    if len(fld) > 0:
                        label = fld[0]["LABEL"]
                        displayindex = fld[0]["DISPLAYINDEX"]

            sql = db.make_insert_sql("onlineformincoming", ( 
                ( "CollationID", db.di(collationid)),
                ( "FormName", db.ds(formname)),
                ( "PostedDate", db.ddt(posteddate)),
                ( "Flags", db.ds(flags)),
                ( "FieldName", db.ds(fieldname)),
                ( "Label", db.ds(label)),
                ( "DisplayIndex", db.di(displayindex)),
                ( "Host", db.ds(remoteip)),
                ( "Value", post.db_string(k))
                ))
            db.execute(dbo, sql)
    # Sort out the preview of the first few fields
    fieldssofar = 0
    preview = []
    for fld in get_onlineformincoming_detail(dbo, collationid):
        if fieldssofar < 3:
            fieldssofar += 1
            preview.append( fld["LABEL"] + ": " + fld["VALUE"] )
    db.execute(dbo, "UPDATE onlineformincoming SET Preview = %s WHERE CollationID = %s" % ( db.ds(", ".join(preview)), db.di(collationid) ))
    # Did the original form specify some email addresses to send 
    # incoming submissions to?
    email = db.query_string(dbo, "SELECT o.EmailAddress FROM onlineform o " \
        "INNER JOIN onlineformincoming oi ON oi.FormName = o.Name " \
        "WHERE oi.CollationID = %d" % int(collationid))
    if email is not None and email.strip() != "":
        utils.send_email(dbo, configuration.email(dbo), email, "", "%s - %s" % (formname, ", ".join(preview)), get_onlineformincoming_plain(dbo, collationid))
    return collationid
Example #15
0
def update_pass_homecheck(dbo, user, personid, comments):
    """
    Marks a person as homechecked and appends any comments supplied to their record.
    """
    by = users.get_personid(dbo, user)
    if by != 0: 
        db.execute(dbo, "UPDATE owner SET HomeCheckedBy = %d WHERE ID = %d" % (by, personid))
    db.execute(dbo, "UPDATE owner SET IDCheck = 1, DateLastHomeChecked = %s WHERE ID = %d" % ( db.dd(now(dbo.timezone)), personid ))
    if comments != "":
        com = db.query_string(dbo, "SELECT Comments FROM owner WHERE ID = %d" % personid)
        com += "\n" + comments
        db.execute(dbo, "UPDATE owner SET Comments = %s WHERE ID = %d" % ( db.ds(com), personid ))
Example #16
0
def update_pass_homecheck(dbo, user, personid, comments):
    """
    Marks a person as homechecked and appends any comments supplied to their record.
    """
    by = users.get_personid(dbo, user)
    if by != 0:
        db.execute(
            dbo, "UPDATE owner SET HomeCheckedBy = %d WHERE ID = %d" %
            (by, personid))
    db.execute(
        dbo,
        "UPDATE owner SET IDCheck = 1, DateLastHomeChecked = %s WHERE ID = %d"
        % (db.dd(now(dbo.timezone)), personid))
    if comments != "":
        com = db.query_string(
            dbo, "SELECT Comments FROM owner WHERE ID = %d" % personid)
        com += "\n" + comments
        db.execute(
            dbo, "UPDATE owner SET Comments = %s WHERE ID = %d" %
            (db.ds(com), personid))
Example #17
0
def check_and_scale_pdfs(dbo):
    """
    Goes through all PDFs in the database to see if they have been
    scaled (have a suffix of _scaled.pdf) and scales down any unscaled
    ones.
    """
    if not gs_installed():
        al.warn("ghostscript is not installed, can't scale pdfs",
                "media.check_and_scale_pdfs", dbo)
        return
    mp = db.query(dbo, \
        "SELECT MediaName FROM media WHERE LOWER(MediaName) LIKE '%.pdf' AND " \
        "LOWER(MediaName) NOT LIKE '%_scaled.pdf'")
    for m in mp:
        filepath = db.query_string(
            dbo, "SELECT Path FROM dbfs WHERE Name='%s'" % m["MEDIANAME"])
        original_name = str(m["MEDIANAME"])
        new_name = str(m["MEDIANAME"])
        new_name = new_name[0:len(new_name) - 4] + "_scaled.pdf"
        inputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        outputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        odata = dbfs.get_string(dbo, original_name)
        inputfile.write(odata)
        inputfile.flush()
        inputfile.close()
        outputfile.close()
        scale_pdf_file(inputfile.name, outputfile.name)
        f = open(outputfile.name, "r")
        data = f.read()
        f.close()
        os.unlink(inputfile.name)
        os.unlink(outputfile.name)
        # Update the media entry with the new name
        db.execute(dbo, "UPDATE media SET MediaName = '%s' WHERE MediaName = '%s'" % \
            ( new_name, original_name))
        # Update the dbfs entry with the new name
        dbfs.rename_file(dbo, filepath, original_name, new_name)
        # Update the PDF file data
        dbfs.put_string(dbo, new_name, filepath, data)
    al.debug("found and scaled %d pdfs" % len(mp),
             "media.check_and_scale_pdfs", dbo)
Example #18
0
def check_and_scale_pdfs(dbo):
    """
    Goes through all PDFs in the database to see if they have been
    scaled (have a suffix of _scaled.pdf) and scales down any unscaled
    ones.
    """
    if not gs_installed(): 
        al.warn("ghostscript is not installed, can't scale pdfs", "media.check_and_scale_pdfs", dbo)
        return
    mp = db.query(dbo, \
        "SELECT MediaName FROM media WHERE LOWER(MediaName) LIKE '%.pdf' AND " \
        "LOWER(MediaName) NOT LIKE '%_scaled.pdf'")
    for m in mp:
        filepath = db.query_string(dbo, "SELECT Path FROM dbfs WHERE Name='%s'" % m["MEDIANAME"])
        original_name = str(m["MEDIANAME"])
        new_name = str(m["MEDIANAME"])
        new_name = new_name[0:len(new_name)-4] + "_scaled.pdf"
        inputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        outputfile = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
        odata = dbfs.get_string(dbo, original_name)
        inputfile.write(odata)
        inputfile.flush()
        inputfile.close()
        outputfile.close()
        scale_pdf_file(inputfile.name, outputfile.name)
        f = open(outputfile.name, "r")
        data = f.read()
        f.close()
        os.unlink(inputfile.name)
        os.unlink(outputfile.name)
        # Update the media entry with the new name
        db.execute(dbo, "UPDATE media SET MediaName = '%s' WHERE MediaName = '%s'" % \
            ( new_name, original_name))
        # Update the dbfs entry with the new name
        dbfs.rename_file(dbo, filepath, original_name, new_name)
        # Update the PDF file data
        dbfs.put_string(dbo, new_name, filepath, data)
    al.debug("found and scaled %d pdfs" % len(mp), "media.check_and_scale_pdfs", dbo)
Example #19
0
File: media.py Project: magul/asm3
def scale_all_odt(dbo):
    """
    Goes through all odt files attached to records in the database and 
    scales them down (throws away images and objects so only the text remains to save space)
    """
    mo = db.query(dbo, "SELECT MediaName FROM media WHERE LOWER(MediaName) LIKE '%.odt'")
    for i, m in enumerate(mo):
        name = str(m["MEDIANAME"])
        al.debug("scaling %s (%d of %d)" % (name, i, len(mo)), "media.scale_all_odt", dbo)
        print "%s (%d of %d)" % (name, i, len(mo))
        odata = dbfs.get_string(dbo, name)
        if odata == "":
            al.error("file %s does not exist" % name, "media.scale_all_odt", dbo)
            print "file %s does not exist" % name
            continue
        path = db.query_string(dbo, "SELECT Path FROM dbfs WHERE Name='%s'" % name)
        ndata = scale_odt(odata)
        if len(ndata) < 512:
            al.error("scaled odt %s came back at %d bytes, abandoning" % (name, len(ndata)), "scale_all_odt", dbo)
            print "file too small < 512, doing nothing"
        else:
            print "old size: %d, new size: %d" % (len(odata), len(ndata))
            dbfs.put_string(dbo, name, path, ndata)
Example #20
0
def get_basecolour_name(dbo, cid):
    if id is None: return ""
    return db.query_string(
        dbo, "SELECT BaseColour FROM basecolour WHERE ID = %d" % cid)
Example #21
0
def guess_agegroup(dbo, s):
    """ Guesses an agegroup, returns the default if no match is found """
    s = str(s).lower()
    guess = db.query_string(dbo, "SELECT ItemValue FROM configuration WHERE ItemName LIKE 'AgeGroup%Name' AND LOWER(ItemValue) LIKE '%" + db.escape(s) + "%'")
    if guess != "": return guess
    return db.query_string(dbo, "SELECT ItemValue FROM configuration WHERE ItemName LIKE 'AgeGroup2Name'")
Example #22
0
def get_onlineform_name(dbo, formid):
    """ Returns the name of a form """
    return db.query_string(
        dbo, "SELECT Name FROM onlineform WHERE ID = %d" % int(formid))
Example #23
0
def get_person_name(dbo, personid):
    """
    Returns the full person name for an id
    """
    return db.query_string(
        dbo, "SELECT OwnerName FROM owner WHERE ID = %d" % int(personid))
Example #24
0
def get_name_for_id(dbo, mid):
    return db.query_string(dbo, "SELECT MediaName FROM media WHERE ID = %d" % mid)
Example #25
0
def get_name_for_id(dbo, mid):
    return db.query_string(dbo,
                           "SELECT MediaName FROM media WHERE ID = %d" % mid)
Example #26
0
def get_sex_name(dbo, sid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT Sex FROM lksex WHERE ID = %d" % sid)
Example #27
0
def get_account_code(dbo, accountid):
    """
    Returns the code for an accountid
    """
    return db.query_string(dbo, "SELECT Code FROM accounts WHERE ID = %d" % int(accountid))
Example #28
0
def get_account_code(dbo, accountid):
    """
    Returns the code for an accountid
    """
    return db.query_string(
        dbo, "SELECT Code FROM accounts WHERE ID = %d" % int(accountid))
Example #29
0
def get_found_person_name(dbo, aid):
    """
    Returns the contact name for a found animal
    """
    return db.query_string(dbo, "SELECT o.OwnerName FROM animalfound a INNER JOIN owner o ON a.OwnerID = o.ID WHERE a.ID = %d" % int(aid))
Example #30
0
def get_name_for_id(dbo, dbfsid):
    """
    Returns the filename of the item with id dbfsid
    """
    return db.query_string(dbo, "SELECT Name FROM dbfs WHERE ID = %d" % dbfsid)
Example #31
0
def get_web_preferred_name(dbo, linktype, linkid):
    return db.query_string(dbo, "SELECT MediaName FROM media " \
        "WHERE LinkTypeID = %d AND WebsitePhoto = 1 AND LinkID = %d" % (linktype, linkid))
Example #32
0
def get_coattype_name(dbo, cid):
    if id is None: return ""
    return db.query_string(
        dbo, "SELECT CoatTypeName FROM lkcoattype WHERE ID = %d" % cid)
Example #33
0
def get_internallocation_name(dbo, lid):
    if id is None: return ""
    return db.query_string(
        dbo, "SELECT LocationName FROM internallocation WHERE ID = %d" % lid)
Example #34
0
def get_logtype_name(dbo, tid):
    if tid is None: return ""
    return db.query_string(dbo, "SELECT LogTypeName FROM logtype WHERE ID = %d" % tid)
Example #35
0
def get_species_name(dbo, sid):
    if id is None: return ""
    return db.query_string(
        dbo, "SELECT SpeciesName FROM species WHERE ID = %d" % sid)
Example #36
0
def get_movementtype_name(dbo, mid):
    if mid is None: return ""
    return db.query_string(dbo, "SELECT MovementType FROM lksmovementtype WHERE ID = %d" % int(mid))
Example #37
0
def get_onlineformincoming_name(dbo, collationid):
    """ Returns the form name for a collation id """
    return db.query_string(dbo, "SELECT FormName FROM onlineformincoming WHERE CollationID = %d LIMIT 1" % int(collationid))
Example #38
0
def get_sex_name(dbo, sid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT Sex FROM lksex WHERE ID = %d" % sid)
Example #39
0
def get_onlineform_name(dbo, formid):
    """ Returns the name of a form """
    return db.query_string(dbo, "SELECT Name FROM onlineform WHERE ID = %d" % int(formid))
Example #40
0
def get_size_name(dbo, sid):
    if sid is None: return ""
    return db.query_string(dbo, "SELECT Size FROM lksize WHERE ID = %d" % sid)
Example #41
0
def get_diarytask_name(dbo, taskid):
    """
    Returns the name for a diarytask
    """
    return db.query_string(dbo, "SELECT Name FROM diarytaskhead WHERE ID=%d" % int(taskid))
Example #42
0
def get_species_name(dbo, sid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT SpeciesName FROM species WHERE ID = %d" % sid)
Example #43
0
def get_onlineformincoming_name(dbo, collationid):
    """ Returns the form name for a collation id """
    return db.query_string(
        dbo,
        "SELECT FormName FROM onlineformincoming WHERE CollationID = %d LIMIT 1"
        % int(collationid))
Example #44
0
def get_person_name(dbo, wid):
    """
    Returns the contact name for the waitinglist with id
    """
    return db.query_string(dbo, "SELECT o.OwnerName FROM animalwaitinglist a INNER JOIN owner o ON a.OwnerID = o.ID WHERE a.ID = %d" % int(wid))
Example #45
0
def get_animaltype_name(dbo, aid):
    if id is None: return ""
    return db.query_string(
        dbo, "SELECT AnimalType FROM animaltype WHERE ID = %d" % aid)
Example #46
0
def get_urgency_name(dbo, uid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT Urgency FROM lkurgency WHERE ID = %d" % uid)
Example #47
0
def get_breed_name(dbo, bid):
    if id is None: return ""
    return db.query_string(dbo,
                           "SELECT BreedName FROM breed WHERE ID = %d" % bid)
Example #48
0
def get_animaltype_name(dbo, aid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT AnimalType FROM animaltype WHERE ID = %d" % aid)
Example #49
0
def get_entryreason_name(dbo, rid):
    if id is None: return ""
    return db.query_string(
        dbo, "SELECT ReasonName FROM entryreason WHERE ID = %d" % rid)
Example #50
0
def get_basecolour_name(dbo, cid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT BaseColour FROM basecolour WHERE ID = %d" % cid)
Example #51
0
def get_movementtype_name(dbo, mid):
    if mid is None: return ""
    return db.query_string(
        dbo,
        "SELECT MovementType FROM lksmovementtype WHERE ID = %d" % int(mid))
Example #52
0
def get_breed_name(dbo, bid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT BreedName FROM breed WHERE ID = %d" % bid)
Example #53
0
def get_size_name(dbo, sid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT Size FROM lksize WHERE ID = %d" % sid)
Example #54
0
def get_coattype_name(dbo, cid):
    if id is None: return ""
    return db.query_string(dbo, "SELECT CoatTypeName FROM lkcoattype WHERE ID = %d" % cid)
Example #55
0
def get_urgency_name(dbo, uid):
    if id is None: return ""
    return db.query_string(dbo,
                           "SELECT Urgency FROM lkurgency WHERE ID = %d" % uid)
Example #56
0
def get_donationtype_name(dbo, did):
    if did is None: return ""
    return db.query_string(dbo, "SELECT DonationName FROM donationtype WHERE ID = %d" % did)
Example #57
0
def get_web_preferred_name(dbo, linktype, linkid):
    return db.query_string(dbo, "SELECT MediaName FROM media " \
        "WHERE LinkTypeID = %d AND WebsitePhoto = 1 AND LinkID = %d" % (linktype, linkid))
Example #58
0
def get_entryreason_name(dbo, rid):
    if rid is None: return ""
    return db.query_string(dbo, "SELECT ReasonName FROM entryreason WHERE ID = %d" % rid)
Example #59
0
def get_stock_location_name(dbo, slid):
    if slid is None: return ""
    return db.query_string(dbo, "SELECT LocationName FROM stocklocation WHERE ID = %d" % slid)
Example #60
0
def get_internallocation_name(dbo, lid):
    if lid is None: return ""
    return db.query_string(dbo, "SELECT LocationName FROM internallocation WHERE ID = %d" % lid)