This method uses inheritance to find the effective locality data.
# - - - B i r d F o r m . g e t L o c G r o u p
def getLocGroup(self):
"""Get the effective locality.
"""
First we get the effective default locality for the day.
See Section 8.2, “DayNotes.defaultLoc(): Return the
default location”, which
returns a location code as a string, and Section 14, “class LocGroup: Sighting's locality” for the constructor that
wraps that in a LocGroup instance.
#-- 1 --
# [ parentGroup := a LocGroup instance representing the
# default locality for self.dayNotes ]
parentGroup = LocGroup(self.dayNotes.defaultLoc())
If there is no locality data at this level, we'll just return
the parent's locality. Otherwise, we'll use the LocGroup.inherit() method to build a new LocGroup instance with default values replaced by
inherited values . See Section 14.3, “LocGroup.inherit(): Implement
inheritance for locations”.
#-- 2 --
# [ if self.locGroup is None ->
# return parentGroup
# else ->
# return a new LocGroup instance made from
# self.locGroup inheriting from parentGroup ]
if self.locGroup:
return self.locGroup.inherit(parentGroup)
else:
return parentGroup