From 0d438c26ca9e07e070b5ef6679d1ea8c2ae157d1 Mon Sep 17 00:00:00 2001 From: Troubardours <arthur.lebars@gmail.com> Date: Wed, 2 Jun 2021 13:28:48 +0200 Subject: [PATCH] fixes for cases where strain and sex attributes are empty --- gga_init.py | 5 +++++ species_data.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gga_init.py b/gga_init.py index af8e2c1..99eb3f6 100755 --- a/gga_init.py +++ b/gga_init.py @@ -62,6 +62,11 @@ class DeploySpeciesStack(species_data.SpeciesData): logging.critical("Cannot access %s" % self.genus_species) sys.exit(exc) + print(self.strain) + print(self.sex) + print(self.strain_sex) + print(self.full_name) + # Copy the custom banner to the species dir (banner used in tripal pages) # If the path specified is invalid (because it's empty or is still the default demo one), # use the default banner instead diff --git a/species_data.py b/species_data.py index 308478e..37cb0de 100644 --- a/species_data.py +++ b/species_data.py @@ -102,8 +102,14 @@ class SpeciesData: self.genus_lowercase = self.genus.lower() self.species_lowercase = self.species.lower() - self.strain_lowercase = self.strain.lower() - self.sex_lowercase = self.sex.lower() + try: + self.strain_lowercase = self.strain.lower() + except AttributeError as exc: + self.strain_lowercase = None + try: + self.sex_lowercase = self.sex.lower() + except AttributeError as exc: + self.sex_lowercase = None self.genus_uppercase = self.genus[0].upper() + self.genus_lowercase[1:] self.genus_species = "{0}_{1}".format(self.genus_lowercase, self.species_lowercase) -- GitLab