This method generates content for one taxon on the index page for the case where more than one form name is referred to that taxon.
# - - - T a x o n P h o t o S e t . _ _ b u i l d M u l t i F o r m s def _buildMultiForms(self, parent): '''Build index and form content for the multi-form case. [ parent is an et.Element -> parent := parent + (self's inverted name) + (links to form pages for forms in self._formMap) form pages for self._formMap values := content displaying thumbnails and catalog info for values in self._formMap ] '''
First we add the form name to the parent
#-- 1 # [ parent := parent with self's name added as text ] self._webName(parent)
The forms referred to this taxon will be displayed in ascending order by inverted English name. This is achieved using the standard Python trick of keeping instances as values in a dictionary, and using a key that sorts in the desired order—in this case, the inverted English name.
For each key in
nameList, the corresponding
value is a
FormPhotoSet instance. The
generation of the index page content, and corresponding photo
page, for each form is done by Section 11.12, “
Build one form link and form page”.
#-- 2 # [ parent := parent with divs added containing the # names from self._formMap, ordered by the keys of # self._formMap, with each as a link to the # corresponding value from self._formMap # form pages for values in self._formMap := content # from those values ] for formName in sorted(self._formMap.keys()): #-- 3 body # [ let formSet == self._formMap[formName] # in # parent := parent with a div added containing the # name from formSet and a link to formSet's form page # form page for formSet := content from formSet ] self._buildFormLine(parent, self._formMap[formName])