Next / Previous / Contents / Shipman's homepage

12.15. BirdForm.writeMulti(): Create multi-sighting XML

birdnotes.py
# - - -   B i r d F o r m . w r i t e M u l t i

    def writeMulti(self, formNode):
        """Generate XML for multiple sightings.

          [ formNode is an et.Element ->
              formNode  :=  formNode + (loc-group and sighting-notes
                  from self) + (rnc.FLOC_N children made from
                  self's sightings ]
        """

For the logic that adds the loc-group and sighting-notes content, see LocGroup-writeNode and SightNotes-writeNode.

birdnotes.py
        #-- 1 --
        # [ if self.locGroup ->
        #     formNode  +:=  self.locGroup as XML
        #   else -> I ]
        if  self.locGroup:
            self.locGroup.writeNode(formNode)

        #-- 2 --
        # [ if self.sightNotes ->
        #     formNode  +:=  self.sightNotes as XML
        #   else -> I ]
        if  self.sightNotes:
            self.sightNotes.writeNode(formNode)

Translate each child Sighting instance into XML; see Sighting-writeNode.

birdnotes.py
        #-- 3 --
        # [ formNode  +:=  rnc.FLOC_N children made from self's
        #                  sightings ]
        for  sighting in self.genSightings():
            sighting.writeNode(formNode)