Next / Previous / Contents / Shipman's homepage

12.13. BirdForm._writeTaxonGroup()

This method adds the taxon-group content to the XML being built.

birdnotes.py
# - - -   B i r d F o r m . _ w r i t e T a x o n G r o u p

    def _writeTaxonGroup(self, formNode):
        """Attach taxon-group content to formNode.

          [ formNode is an et.Element ->
              formNode  +:=  self's taxon-group content ]
        """

The ab6 attribute is required. The rel attribute is optional, but if it is used, there must also be an alt attribute. Finally, the notable attribute is optional.

birdnotes.py
        #-- 1 --
        # [ formNode  +:=  an rnc.AB6_A attribute made from 
        #       self.birdId.abbr ]
        formNode.attrib[rnc.AB6_A] = self.birdId.abbr.lower().strip()

        #-- 2 --
        # [ if self.rel ->
        #     formNode  :=  formNode with an rnc.REL_A attribute
        #         made from self.rel and an rnc.ALT_A attribute
        #         made from self.alt
        #   else -> I ]
        if  self.birdId.rel != abbrModule.REL_SIMPLE:
            formNode.attrib[rnc.REL_A] = self.birdId.rel
            abbr2 = self.birdId.abbr2.lower().strip()
            formNode.attrib[rnc.ALT_A] = abbr2

        #-- 3 --
        if  self.notable:
            formNode.attrib[rnc.NOTABLE_A] = '1'