Next / Previous / Contents / Shipman's homepage

16. class Photo: Photo link

Represents one image theoretically depicting at least one of the observed individuals. See the definition of the photo element in the schema.

birdnotes.py
# - - - - -   c l a s s   P h o t o

class Photo:
    """Represents one photo with birds in.

      Exports:
        Photo ( catNo, url=None, text=None ):
          [ (catNo is a catalog number as a string) and
            (url is a link to the image, or None if no image) and
            (text is comment text as a string) ->
              return a new Photo instance with those values ]
        Photo.readNode):    # Static.readNode method
          [ node is an et.Element ->
              if node conforms to birdnotes.rnc ->
                return a new Photo instance representing node
              else -> raise ValueError ]
        .writeNode ( parent ):
          [ parent is an et.Element ->
              parent  :=  parent with a new rnc.PHOTO_N node
              sighting.sightNotes  =  SightNotes.readNode ( flocNode )
                          added representing self ]
    """

16.1. Photo.__init__()

birdnotes.py
# - - -   P h o t o . _ _ i n i t _ _

    def __init__ ( self, catNo, url=None, text=None ):
        """Constructor for Photo.
        """
        self.catNo  =  catNo
        self.url  =  url
        self.text  =  text