a.IsGoodWithDogs = 2 a.IsGoodWithChildren = 2 a.HouseTrained = asm.iif(d["Housebroken"] == "Yes", 0, 2) a.Archived = 0 a.EntryReasonID = 1 if d["Intake Type"] == "Born In-House": a.EntryReasonID = 13 if d["Intake Type"] == "Pet Pulled" or d[ "Intake Type"] == "Rescue Transfer" or d[ "Intake Type"] == "Shelter Transfer": a.EntryReasonID = 15 if d["Intake Type"] == "Abandoned" or d[ "Intake Type"] == "Voluntary Surrender": a.EntryReasonID = 11 a.BreedID = asm.breed_id_for_name(d["Primary Breed"]) a.Breed2ID = a.BreedID a.BreedName = asm.breed_name_for_id(a.BreedID) a.CrossBreed = 0 if d["Mix Breed"].strip() != "": a.CrossBreed = 1 if d["Mix Breed"] == "Unknown Mixed Breed": a.Breed2ID = 442 else: a.Breed2ID = asm.breed_id_for_name(d["Mix Breed"]) if a.Breed2ID == 1: a.Breed2ID = 442 a.BreedName = "%s / %s" % (asm.breed_name_for_id( a.BreedID), asm.breed_name_for_id(a.Breed2ID)) comments = "Intake type: %s\nStatus: %s\nBreed: %s / %s\nAge: %s\nTemperament: %s" % \ (d["Intake Type"], d["Status"], d["Primary Breed"], d["Mix Breed"], d["Age"], d["Temperament"]) a.HiddenAnimalDetails = comments description = d["Description/Story"].replace("<p>", "").replace("\n", "").replace(
if row["DateIN"].strip() != "": a.DateBroughtIn = getdate(row["DateIN"]) if a.DateBroughtIn is None: a.DateBroughtIn = getdate(row["AddDateTime"]) if a.DateBroughtIn is None: print "BOLLOCKS: " + str(row) if row["DateOUT"].strip() != "": a.ActiveMovementDate = getdate(row["DateOUT"]) if a.ActiveMovementDate is not None: a.ActiveMovementType = 1 a.Archived = 1 elif a.DateBroughtIn.year < 2015: a.Archived = 1 a.Neutered = row["desexdate"].strip() != "" and 1 or 0 a.NeuteredDate = getdate(row["desexdate"]) a.BreedName = asm.breed_name_for_id(a.BreedID) a.CrossBreed = row["crossbreed"] == "TRUE" and 1 or 0 if a.CrossBreed == 1: a.Breed2ID = 442 if row["dob"].strip() != "": a.DateOfBirth = getdate(row["dob"]) if a.DateOfBirth is None: a.DateOfBirth = a.DateBroughtIn a.IdentichipNumber = row["MicroChip"] if a.IdentichipNumber != "": a.Identichipped = 1 a.Sex = getsex12(row["Sex"]) a.Weight = asm.cfloat(row["weight"]) a.BaseColourID = asm.colour_id_for_name(row["Colour"]) a.ShelterLocation = 1 a.generateCode(asm.type_name_for_id(a.AnimalTypeID)) a.ReasonForEntry = row["dep_sReason"]
a = ppa[row["ANIMALUID"]] else: a = asm.Animal() animals.append(a) ppa[row["ANIMALUID"]] = a a.SpeciesID = asm.species_id_for_name(row["SPECIES"]) if a.SpeciesID == 1 and row["INTAKE"].startswith("Stray"): a.AnimalTypeID = 10 elif a.SpeciesID == 1: a.AnimalTypeID = 2 elif a.SpeciesID == 2 and row["INTAKE"].startswith("Stray"): a.AnimalTypeID = 12 else: a.AnimalTypeID = 11 a.BreedID = asm.breed_id_for_name(row["PRIMARY BREED"]) a.BreedName = asm.breed_name_for_id(a.BreedID) a.Sex = asm.getsex_mf(row["SEX"]) a.CrossBreed = 0 a.generateCode(gettypeletter(a.AnimalTypeID)) a.ShortCode = row["ANIMALUID"] a.AnimalName = row["NAME"] if a.AnimalName.strip() == "": a.AnimalName = "(unknown)" a.DateOfBirth = getdate(row["BIRTHDATE"]) a.DateBroughtIn = getdate(row["INTAKETS"]) if a.DateBroughtIn is None: a.DateBroughtIn = datetime.datetime.today() a.LastChangedDate = a.DateBroughtIn a.CreatedDate = a.DateBroughtIn a.Neutered = row["ALTERED"] == "Y" and 1 or 0 a.NeuteredDate = (row["ALTEREDATINTAKE"] == "N"
if a.SpeciesID == 1: a.AnimalTypeID = 2 # dog if a.SpeciesID == 2: a.AnimalTypeID = 11 # unwanted cat a.AnimalName = d["Name"] if a.AnimalName.strip() == "": a.AnimalName = "(unknown)" a.DateBroughtIn = getdate(d["Date In"]) or asm.today() if d["DOB"].strip() != "": a.DateOfBirth = getdate(d["DOB"]) if a.DateOfBirth is None: a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365) a.CreatedDate = a.DateBroughtIn a.LastChangedDate = a.DateBroughtIn a.ShortCode = d["File"] a.ShelterCode = str(a.ID) + " " + d["File"] a.BreedID = asm.breed_id_for_name(d["Breed"].replace(" mix", "")) a.BreedName = asm.breed_name_for_id(a.BreedID) if d["Breed"].find("mix") != -1: a.CrossBreed = 1 a.Breed2ID = 442 a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID) a.BaseColourID = asm.colour_id_for_name(d["Color"]) a.Sex = asm.getsex_mf(d["Male Female"]) a.Weight = asm.cint(d["Weight"].replace("lbs", "").strip()) if a.Weight > 0: l = asm.Log() logs.append(l) l.LogTypeID = 4 # Weight l.LinkID = a.ID l.LinkType = 0
a.DateBroughtIn = datetime.datetime.today() a.SpeciesID = getspecies(row[GUEST_DOG]) a.AnimalTypeID = gettype(row[GUEST_DOG]) a.AnimalName = row[GUEST_SHELTER_GUEST_NAME] if a.AnimalName.strip() == "": a.AnimalName = "(unknown)" a.generateCode(gettypeletter(a.AnimalTypeID)) a.ShortCode = row[GUEST_PIN_ID] a.Sex = getsexmf(row[GUEST_MALE]) breed = row[GUEST_BREED] if breed.find("MIX") != -1: a.CrossBreed = 1 breed = breed.replace("MIX", "") a.BreedID = asm.breed_id_for_name(breed) a.Breed2ID = 442 a.BreedName = asm.breed_name_for_id(a.BreedID) + " / Crossbreed" else: a.BreedID = asm.breed_id_for_name(breed) a.BreedName = asm.breed_name_for_id(a.BreedID) a.DateOfBirth = getdateage(row[GUEST_AGE], row[GUEST_PIN_INTAKE_DATE]) a.EstimatedDOB = 1 a.BaseColourID = asm.colour_id_for_name(row[GUEST_COLOR]) a.IdentichipNumber = row[GUEST_MICROCHIP__] if a.IdentichipNumber.strip() != "": a.Identichipped = 1 a.IdentichipDate = a.DateBroughtIn a.RabiesTag = row[ADOPT_RABIES_TAG__] a.EntryReasonID = 1 a.IsNotAvailableForAdoption = 0 a.ShelterLocation = 1 a.Sex = getsexmf(row[GUEST_MALE]) if strip(row, VET_ALTERED) != "":
a.AnimalTypeID = asm.type_id_for_name(d["SPECIES"]) a.generateCode() a.ShortCode = d["ANIMALNO"] a.Sex = asm.getsex_mf(d["SEX"]) a.BreedID = asm.breed_id_for_name(d["BREED1"]) if d["BREED2"] == "Unspecified": a.Breed2ID = a.BreedID a.CrossBreed = 0 else: a.CrossBreed = 1 a.Breed2ID = asm.breed_id_for_name(d["BREED2"]) a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID) if d["BREED2"].find("Mix") != -1: a.CrossBreed = 1 a.Breed2ID = 442 a.BreedName = asm.breed_name_for_id(a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID) a.BaseColourID = asm.colour_id_for_name(d["COLOR1"]) a.DateBroughtIn = d["FOUNDDATE"] if a.DateBroughtIn is None: a.DateBroughtIn = asm.now() a.Neutered = asm.iif(d["ALTERED"] == "Yes", 1, 0) a.DateOfBirth = d["BIRTHDATE"] if a.DateOfBirth is None: a.EstimatedDOB = 1 a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365) a.PickupAddress = d["CITY"] a.AnimalComments = d["NOTES"] a.Markings = d["MARKINGS"] comments = "Status: %s" % d["STATUS"] comments += "\nOriginal breed: %s / %s" % (d["BREED1"], d["BREED2"]) comments += "\nColor: %s / %s" % (d["COLOR1"], d["COLOR2"]) comments += "\nPattern: %s" % d["PATTERN"]
a.IsNotAvailableForAdoption = 0 a.ShelterLocation = 1 a.Sex = asm.getsex_mf(asm.fw(row["GENDER"])) a.Size = getsize(asm.fw(row["WEIGHT"])) a.BaseColourID = asm.colour_id_for_names(asm.fw(row["FURCOLR1"]), asm.fw(row["FURCOLR2"])) a.IdentichipNumber = row["MICROCHIP"] if a.IdentichipNumber != "": a.Identichipped = 1 if len(a.IdentichipNumber) == 8: a.IdentichipNumber = "0" + a.IdentichipNumber comments = "Original breed: " + row["BREED1"] + "/" + row["CROSSBREED"] + ", age: " + age comments += ",Color: " + asm.fw(row["FURCOLR1"]) + "/" + asm.fw(row["FURCOLR2"]) comments += ", Coat: " + row["COAT"] comments += ", Collar: " + row["COLLRTYP"] comments += ", Disposition: " + row["LICENSE"] a.BreedID = asm.breed_id_for_name(row["BREED1"]) a.Breed2ID = a.BreedID a.BreedName = asm.breed_name_for_id(a.BreedID) if row["PUREBRED"] == "0": a.Breed2ID = asm.breed_id_for_name(row["CROSSBREED"]) if a.Breed2ID == 1: a.Breed2ID = 442 a.BreedName = "%s / %s" % ( asm.breed_name_for_id(a.BreedID), asm.breed_name_for_id(a.Breed2ID) ) a.HiddenAnimalDetails = comments # They also jammed rabies into VACC a.RabiesTag = row["VACC"] # If the animal is dead, mark it as such if row["LICENSE"] == "DECEASED": a.Archived = 1 a.DeceasedDate = a.DateBroughtIn elif row["PERSOWNR"] != "0" and row["PERSOWNR"].strip() != "": # Is there an adopter link? asm.adopt_to(a, ppo[row["PERSOWNR"]].ID) else:
row, O_ADDR_2)) o.OwnerTown = strip(row, O_CITY) o.OwnerPostcode = strip(row, O_PCODE) o.HomeTelephone = strip(row, OWNER_NTF) breed = strip(row, BREED) category = strip(row, CATEGORY) atype = strip(row, TYPE_) #a.AnimalTypeID = gettype(cardno) a.AnimalTypeID = gettypefromcattyp(category, atype) speciesid, breedid = getbreedsp(category, atype, breed) a.SpeciesID = speciesid if breed.lower().startswith("x ") and len(breed) > 2: a.CrossBreed = 1 a.Breed2ID = CROSSBREED_ID a.BreedID = breedid a.BreedName = "%s / CrossBreed" % asm.breed_name_for_id(a.BreedID) else: a.BreedID = breedid a.Breed2ID = a.BreedID a.BreedName = asm.breed_name_for_id(a.BreedID) a.BaseColourID = asm.colour_id_for_name(row[COLOUR], True) a.Sex = getsexmf(row[SEX]) # No age/dob field, assume one year old at induction dob = getdate(row[TODAY]) if dob is None: dob = datetime.datetime.today() dob -= datetime.timedelta(days=365) a.DateOfBirth = dob a.EstimatedDOB = 1 a.Archived = 0 a.PTSReasonID = 11 a.EntryReasonID = 12
o.OwnerAddress = "%s\n%s" % (strip(row, O_ADDR_1), strip(row, O_ADDR_2)) o.OwnerTown = strip(row, O_CITY) o.OwnerPostcode = strip(row, O_PCODE) o.HomeTelephone = strip(row, OWNER_NTF) breed = strip(row, BREED) category = strip(row, CATEGORY) atype = strip(row, TYPE_) #a.AnimalTypeID = gettype(cardno) a.AnimalTypeID = gettypefromcattyp(category, atype) speciesid, breedid = getbreedsp(category, atype, breed) a.SpeciesID = speciesid if breed.lower().startswith("x ") and len(breed) > 2: a.CrossBreed = 1 a.Breed2ID = CROSSBREED_ID a.BreedID = breedid a.BreedName = "%s / CrossBreed" % asm.breed_name_for_id(a.BreedID) else: a.BreedID = breedid a.Breed2ID = a.BreedID a.BreedName = asm.breed_name_for_id(a.BreedID) a.BaseColourID = asm.colour_id_for_name(row[COLOUR], True) a.Sex = getsexmf(row[SEX]) # No age/dob field, assume one year old at induction dob = getdate(row[TODAY]) if dob is None: dob = datetime.datetime.today() dob -= datetime.timedelta(days=365) a.DateOfBirth = dob a.EstimatedDOB = 1 a.Archived = 0 a.PTSReasonID = 11 a.EntryReasonID = 12