コード例 #1
0
ファイル: shelterbuddy.py プロジェクト: magul/asm3
 # Depending on the version of shelterbuddy, sometimes there's 
 ## type, breed and secondBreed cols that dereference the tables
 typecol = ""
 breedcol = ""
 breed2col = ""
 if row.has_key("type"):
     typecol = row["type"]
     breedcol = row["breed"]
     breed2col = row["secondBreed"]
 else:
     # We're going to have to look them up from the speciesID and
     # secondarySpeciesID fields
     typecol = getsbtypenamefromspeciesid(row["speciesID"])
     breedcol = getsbbreednamefromspeciesid(row["speciesID"])
     breed2col = getsbbreednamefromspeciesid(row["secondarySpeciesID"])
 a.AnimalTypeID = asm.type_id_for_name(typecol)
 a.SpeciesID = asm.species_id_for_name(typecol)
 a.BreedID = asm.breed_id_for_name(breedcol)
 a.Breed2ID = asm.breed_id_for_name(breed2col)
 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:
コード例 #2
0
ファイル: petwhere_dbf.py プロジェクト: tgage/asm3
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 if d["SPECIES"] == "Dog":
     # Canine
     a.SpeciesID = 1
     a.AnimalTypeID = 10
     a.EntryReasonID = 11
 elif d["SPECIES"] == "Cat":
     # Feline
     a.SpeciesID = 2
     a.EntryReasonID = 11
     a.AnimalTypeID = 12
 else:
     # Other species
     a.SpeciesID = asm.species_id_for_name(d["SPECIES"])
     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)
コード例 #3
0
ファイル: ishelters.py プロジェクト: magul/asm3
    types = "" 
    if types.find("Volunteer") != -1: o.IsVolunteer = 1
    if types.find("Employee") != -1: o.IsStaff = 1
    if types.find("Member") != -1: o.IsMember = 1
    if types.find("Foster") != -1: o.IsFosterer = 1

# animals.csv
for row in asm.csv_to_list(PATH + "animals.csv"):
    a = asm.Animal()
    animals.append(a)
    ppa[row["id"]] = a
    a.AnimalName = row["name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.ShortCode = row["code"]
    a.AnimalTypeID = asm.type_id_for_name(row["species"])
    a.SpeciesID = asm.species_id_for_name(row["species"])
    a.BreedID = asm.breed_id_for_name(row["primary breed"])
    a.Breed2ID = asm.breed_id_for_name(row["secondary breed"])
    a.CrossBreed = asm.iif(row["secondary breed"] != "", 1, 0)
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    a.BaseColourID = asm.colour_id_for_name(row["primary color"])
    a.Sex = asm.getsex_mf(row["sex"])
    a.DateBroughtIn = asm.getdate_iso(row["time entered"])
    a.DateOfBirth = asm.getdate_iso(row["birth date"])
    if a.DateOfBirth is None: a.DateOfBirth = asm.getdate_iso(row["time entered"])
    a.NeuteredDate = asm.getdate_iso(row["neutered/spayed date"])
    if a.NeuteredDate is not None: a.Neutered = 1
    a.Archived = 0
    a.IdentichipNumber = row["microchip #"]
    if a.IdentichipNumber != "": a.Identichipped = 1
コード例 #4
0
ファイル: shelterbuddy.py プロジェクト: tgage/asm3
 # Depending on the version of shelterbuddy, sometimes there's
 ## type, breed and secondBreed cols that dereference the tables
 typecol = ""
 breedcol = ""
 breed2col = ""
 if row.has_key("type"):
     typecol = row["type"]
     breedcol = row["breed"]
     breed2col = row["secondBreed"]
 else:
     # We're going to have to look them up from the speciesID and
     # secondarySpeciesID fields
     typecol = getsbtypenamefromspeciesid(row["speciesID"])
     breedcol = getsbbreednamefromspeciesid(row["speciesID"])
     breed2col = getsbbreednamefromspeciesid(row["secondarySpeciesID"])
 a.AnimalTypeID = asm.type_id_for_name(typecol)
 a.SpeciesID = asm.species_id_for_name(typecol)
 a.BreedID = asm.breed_id_for_name(breedcol)
 a.Breed2ID = asm.breed_id_for_name(breed2col)
 if row["DateIN"].strip() != "":
     a.DateBroughtIn = getdate(row["DateIN"])
     if a.DateBroughtIn is None:
         a.DateBroughtIn = getdate(row["AddDateTime"])
         if a.DateBroughtIn is None:
             a.DateBroughtIn = asm.now()
 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 < asm.now().year - 1:
コード例 #5
0
# animals.csv
for row in asm.csv_to_list(PATH + "animals.csv", remove_non_ascii=True):
    if row["name"] is None: continue
    if row["code"] is None or row["code"] == "": continue
    if row["primary breed"] is None or row["primary breed"] == "": continue
    if row["species"] is None or row["species"] == "": continue
    if row["primary color"] is None or row["primary color"] == "": continue
    a = asm.Animal()
    animals.append(a)
    ppa[row["id"]] = a
    a.AnimalName = row["name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.ShortCode = row["code"]
    a.AnimalTypeID = asm.type_id_for_name(row["species"])
    a.SpeciesID = asm.species_id_for_name(row["species"])
    a.BreedID = asm.breed_id_for_name(row["primary breed"])
    a.Breed2ID = asm.breed_id_for_name(row["secondary breed"])
    a.CrossBreed = asm.iif(row["secondary breed"] != "", 1, 0)
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    a.BaseColourID = asm.colour_id_for_name(row["primary color"])
    a.Sex = asm.getsex_mf(row["sex"])
    a.DateBroughtIn = asm.getdate_iso(row["time entered"])
    if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
    a.DateOfBirth = asm.getdate_iso(row["birth date"])
    if a.DateOfBirth is None:
        a.DateOfBirth = asm.getdate_iso(row["time entered"])
    if a.DateOfBirth is None: a.DateOfBirth = a.DateBroughtIn
    a.NeuteredDate = asm.getdate_iso(row["neutered/spayed date"])
    if a.NeuteredDate is not None: a.Neutered = 1