Next / Previous / Contents / TCC Help System / NM Tech homepage

25. AccessSummary.__init__(): Constructor

webstats.py
# - - -   A c c e s s S u m m a r y . _ _ i n i t _ _

    def __init__ ( self, cutoffTime, now ):
        '''Constructor for AccessSummary.
        '''

We start by computing the time interval covered by the report. See Section 51.2, “class FixedTimeZone for the time zone identifier; we will use UTC for all times. The self.oldestHit attribute is initialized to the current time; as we accept access records, we will compute a running minimum in this value. Then we create the .sumHitCount attribute as a new, empty HitCount instance—the URL will not be used in this instance.

webstats.py
        #-- 1 --
        # [ self.cutoffTime  :=  cutoffTime
        #   self.now, self.oldestHit  :=  now
        #   self.sumHitCount  :=  a new, empty HitCount ]
        self.cutoffTime  =  cutoffTime
        self.now  =  self.oldestHit  =  now
        self.sumHitCount  =  HitCount('')

All that remains is to establish the invariants on the various private attributes.

webstats.py
        #-- 2 --
        self.__urlMap  =  {}
        self.__personalLetterMap  =  {}
        self.__personalMap  =  {}
        self.__officialMap  =  {}