This method adds the new photo to the forms in self.
# - - - T a x o n P h o t o S e t . _ _ a d d R e f e r r e d def _addReferred(self, birdId, archImage): '''Add a catalog entry to one of the FormPhotoSets in self. [ (birdId is a BirdId referred to self.taxon) and (archImage is a catalog entry as an archindex.ArchImage) -> self._formMap := self._formMap with archImage added under the name from birdId ] '''
The first step is to make sure there is a
under the name used by
Section 12, “
class FormPhotoSet: All photos for one
#-- 1 # [ formName := inverted English name from birdId ] formName = birdId.engComma() #-- 2 # [ if self._formMap has a key formName -> # formSet := the corresponding value # else -> # self._formMap := a new FormPhotoSet instance # for formName # formSet := that new FormPhotoSet instance ] try: formSet = self._formMap[formName] except KeyError: formSet = FormPhotoSet(birdId) self._formMap[formName] = formSet
At this point,
formSet is the
FormPhotoSet instance to which the new photo is
to be added. See Section 12.2, “
FormPhotoSet.addArchImage(): Add one
#-- 3 # [ formSet := formSet with archImage added ] formSet.addArchImage(archImage)