Skip to content
Snippets Groups Projects

Add a picture in Tripal home page

Merged Loraine Gueguen requested to merge release_2.1 into dev
All threads resolved!
2 files
+ 3
3
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 19
4
@@ -76,6 +76,20 @@ class DeploySpeciesStack(speciesData.SpeciesData):
logging.debug("Using default banner for Tripal pages")
self.config.pop(constants.CONF_TRIPAL_BANNER_PATH, None)
# Copy the organism picture for tripal if one was specified in the input species
if self.picture_path is not None:
if os.path.isfile(self.picture_path):
picture_path_basename = os.path.basename(self.picture_path)
picture_path_filename, picture_path_extension = os.path.splitext(picture_path_basename)
if picture_path_extension == ".png" or picture_path_extension == ".jpg":
picture_dest_name = "species%s" % picture_path_extension
picture_dest_path = os.path.join(self.species_dir, picture_dest_name)
shutil.copy(self.picture_path, picture_dest_path)
else:
logging.error("Specified organism picture has wrong extension (must be '.png' or '.jpg'): {0}".format(self.picture_path))
else:
logging.error("Specified organism picture not found {0} for {1}".format(self.picture_path, self.genus_uppercase + " " + self.species))
# Create nginx dirs and write/re-write nginx conf
make_dirs(dir_paths_li=["./nginx", "./nginx/conf"])
try:
@@ -111,11 +125,12 @@ class DeploySpeciesStack(speciesData.SpeciesData):
# We need a dict holding all key (variables) - values that needs to be replaced in the template as our rendering dict
# To do so we need both input file vars and config vars
# Create input file vars dict
input_vars = {"genus": self.genus_lowercase, "Genus": self.genus_uppercase, "species": self.species,
"genus_species": self.genus_species, "genus_species_strain_sex": self.species_folder_name,
"genus_species_sex": "{0}_{1}_{2}".format(self.genus_lowercase, self.species.lower(), self.sex),
"strain": self.strain, "sex": self.sex, "Genus_species": self.genus_species[0].upper() + self.genus_species[1:],
"blast": self.blast}
"genus_species": self.genus_species, "genus_species_strain_sex": self.species_folder_name,
"genus_species_sex": "{0}_{1}_{2}".format(self.genus_lowercase, self.species.lower(), self.sex),
"strain": self.strain, "sex": self.sex, "Genus_species": self.genus_species[0].upper() + self.genus_species[1:],
"blast": self.blast, "picture_path": self.picture_path}
if (len(self.config.keys()) == 0):
logging.error("Empty config dictionary")
# Merge the two dicts
Loading