a.DateBroughtIn = getdate(d["intake_date"]) if a.DateBroughtIn is None: a.DateBroughtIn = getdate(d["created_at"]) a.DateOfBirth = getdate(d["birthday"]) if a.DateOfBirth is None: a.DateOfBirth = a.DateBroughtIn a.Sex = 1 if d["gender"] == "1": # They use 1 for female, 0 for male a.Sex = 0 a.Size = asm.cint(d["size_when_grown"]) primary = d["breed"] secondary = d["breed_secondary"] asm.breed_ids(a, primary, secondary, DEFAULT_BREED) color = d["color_primary"] a.BaseColourID = asm.colour_id_for_name(color) a.IdentichipNumber = d["tattoo"] if a.IdentichipNumber != "": a.Identichipped = 1 a.Weight = asm.atof(d["weight"]) a.Neutered = d["altered"] == "true" and 1 or 0 intaketype = d["intake_reason"] if intaketype.find("Transfer In") != -1: a.IsTransfer = 1 a.EntryReasonID = 15 elif intaketype.find("Stray") != -1: a.EntryReasonID = 7 elif intaketype.find("Surrender") != -1 or intaketype.find("Return") != -1: a.EntryReasonID = 17 else: a.EntryReasonID = 15 # Stray a.Fee = asm.cint(d["adoption_fees_amount"]) * 100 a.HiddenAnimalDetails = "Breed: %s / %s, Color: %s / %s\nIntake Location: %s" % ( primary, secondary, color, d["color_secondary"], d["intake_location"]) if d["foster_tag"] != "":
if b.endswith("Y"): dob = asm.subtract_days(dob, 365 * asm.atoi(b)) if b.endswith("M"): dob = asm.subtract_days(dob, 30 * asm.atoi(b)) if b.endswith("D"): dob = asm.subtract_days(dob, asm.atoi(b)) a.DateOfBirth = dob a.Sex = 1 if d["Sex"].startswith("F"): a.Sex = 0 primary = d["Primary Breed"] secondary = "" if "Secondary Breed" in d: secondary = d["Secondary Breed"] asm.breed_ids(a, primary, secondary, DEFAULT_BREED) color = "Black" if "Primary Color" in d: color = d["Primary Color"] a.BaseColourID = asm.colour_id_for_name(color) if "Current Weight" in d and d["Current Weight"] != "": a.Weight = asm.atof(d["Current Weight"]) a.HiddenAnimalDetails = "Age: %s, Breed: %s / %s, Color: %s" % ( age, primary, secondary, color) if "Attributes" in d and d["Attributes"] != "": a.HiddenAnimalDetails += "\nAttributes: " + d["Attributes"] if d["Attributes"].find("Special Needs") != -1: a.HasSpecialNeeds = 1 if d["Attributes"].find("Cat Friendly") != -1: a.IsGoodWithCats = 0 if d["Attributes"].find("No cats") != -1: a.IsGoodWithCats = 1 if d["Attributes"].find("Dog Social") != -1: a.IsGoodWithDogs = 0 if d["Attributes"].find("No dogs") != -1 or d["Attributes"].find( "no other dogs") != -1: a.IsGoodWithDogs = 1 if d["Attributes"].find("No small children") != -1: a.IsGoodWithChildren = 5 if "Kennel Card / Web Site Memo" in d: a.AnimalComments = d["Kennel Card / Web Site Memo"]