Next / Previous / Contents / Shipman's homepage

25.2. Logic errors

  1. In YearRow.readOneMonth(), neglected to prepend the year number and a slash to the actual file name passed to birdNoteSet.readFile().

  2. There's no need to add an h1 heading in the page body, because tccpage2 supplies one already. Remove this logic from indexBoilerPlate().

  3. In YearRow.readOneMonth(), the intended function was correct, but the code was wrong:

            # [ self.__monthMap[mm]  :=  a new MonthCell instance
            #       with self as the parent, month=mm, and
            #       birdNoteSet=birdNoteSet ]
            monthCell  =  MonthCell ( self, mm, birdNoteSet )

    should be:

            self.__monthMap[mm]  =  MonthCell ( self, mm, birdNoteSet )

  4. In buildRow(), neglected to place the year into the cell.

        # [ tr  +:=  a th element with class=ROW_LABEL_CLASS
        #            containing yearRow.yyyy ]
        rowLabel  =  et.SubElement ( tr, 'th' )
        rowLabel.attrib['class']  =  ROW_LABEL_CLASS    

    Add this line:

        rowLabel.text  =  yearRow.yyyy

  5. In YearCollection.findNext(), this logic returned a month number 'mm' when it should have returned a full key 'yyyy-mm'.

            # [ if any year with a key in yyyyList[pos+1:] has at
            #   least one month in it ->
            #     return the yyyy-mm key of the first month in
            #     the first such year
            #   else -> I ]
            for nextYear in yyyyList[pos+1:]:
                nextRow =  self[nextYear]
                if len(nextRow) > 0:
                    return nextRow.firstMonth()

    Make that last line:

                    firstMM  =  nextRow.firstMonth()
                    return '%s-%s' % (nextYear, firstMM)

    Symmetrical fix in YearCollection.findPrev():

                if len(prevRow) > 0:
                    lastMM  =  prevRow.lastMonth()
                    return '%s-%s' % (prevYear, lastMM)

  6. MonthCell.__pageFrame() completely neglected to consider the case where either the previous or next page link is None. Pretty much rewrote the whole method.

  7. In MonthCell.__sightNotes(), a cut-and-paste error:

            if sightNotes.voc is not None:
                self.__annoBlock ( parent, 'Vocalizations:',
                                   sightNotes.behavior )

    The last statement should be:

                self.__annoBlock ( parent, 'Vocalizations:',
                                   sightNotes.voc )

    Several quite similar errors in MonthCell.__dayAnnotation:

            #-- 2 --
            if is not None:
                self.__annoBlock ( parent, 'Weather', daySummary.route )
            #-- 3 --
            if daySummary.missed is not None:
                self.__annoBlock ( parent, 'Missed', daySummary.route )

  8. Completely forgot about photo links.