class SADS: def __init__(self): # SADS dictionary data structure self.sadsDictionary = {} # MySQL object self.mysql = SADS_Mysql() self.mysql.connect() #end def __init__(self): # Main handler method deals with Visitor's information def handleVisitorInfo(self, visitorInfo): location_ip = Utilities.convertNumericIpToHex(visitorInfo['ip']) newVisitCount = self.mysql.getVisitCount(location_ip) if self.sadsDictionary.has_key(visitorInfo['ip']): currentVisitCount = self.sadsDictionary[visitorInfo['ip']] if currentVisitCount != newVisitCount -1 and currentVisitCount != newVisitCount: print 'Warning: visit count is jumped from '+ str(currentVisitCount) + " to " + str(newVisitCount) self.sadsDictionary[visitorInfo['ip']] = newVisitCount print self.sadsDictionary
def __init__(self): # SADS dictionary data structure self.sadsDictionary = {} # MySQL object self.mysql = SADS_Mysql() self.mysql.connect()