Show
Ignore:
Timestamp:
11/29/08 00:48:18 (3 years ago)
Author:
cfreeze@…
Branch:
default
Parents:
189:8190540dae37 (diff), 185:c20e85874308 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

correct merge problems that are showing up from bad branching

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • StormSiren/StormWeather.py

    r184 r190  
    4848from WeatherAlert import * 
    4949from XmlWeather import * 
    50 from CAP import CAP 
    5150 
    5251class StormWeather(XmlWeather): 
    53         def __init__(self, state, history, simfetch = False, simalert = False): 
    54                 super(StormWeather,self).__init__(state,history,simfetch) 
     52        def __init__(self, state, history, simfetch = False, simalert = False, proxy = None): 
     53                super(StormWeather,self).__init__(state,simfetch,proxy) 
    5554                self.log = logging.getLogger("StormWeather") 
    5655                self.__alert_devs = [] 
    5756                self.__simalert = simalert 
     57                self.__history = history 
    5858 
    5959                self.log.setLevel(logging.INFO) 
    6060         
    61         def display(self): 
    62                 return self.__str__() 
    63  
    6461        def __str__(self): 
    6562                str  = "StormWeather: " + "\n" 
     
    7269                return str 
    7370 
    74         def display(self): 
    75                 print self.__str__() 
    76  
    7771        def registerDevice(self, dev): 
    7872                self.log.debug("Registering Device") 
    7973                self.__alert_devs.append(dev) 
    8074 
    81         def handleAlert(self, cap_item): 
    82                 alerted = False 
     75        def logAtomShort(self, cap_atom): 
     76                self.log.info("---------CAP ATOM---------") 
     77                for l in (cap_atom.__str__().split('\n')): 
     78                        self.log.info(l) 
     79                self.log.info("---------CAP ATOM---------") 
    8380 
    84                 for dev in self.__alert_devs: 
    85                         if(dev.isAlertWanted(cap_item)): 
    86                                 if(not self.__simalert): 
    87                                         dev.send(WeatherAlert(cap_item)) 
    88                                         alerted = True 
    89                                 else: 
    90                                         self.log.info("Simulated Alert on: %s" % cap_item.id) 
     81        def logAtomFull(self, cap_atom): 
     82                self.log.info("---------CAP ATOM---------") 
     83                for l in (cap_atom.__str__().split('\n')): 
     84                        self.log.info(l) 
     85                self.log.info("========DESCRIPTION=======") 
     86                if(cap_atom.description): 
     87                        for l in (cap_atom.description.split('\n')): 
     88                                self.log.info(l) 
     89                self.log.info("========DESCRIPTION=======") 
     90                self.log.info("---------CAP ATOM---------") 
    9191 
    92                 return alerted 
     92        def handleAtom(self, cap_atom): 
     93                self.logAtomShort(cap_atom) 
     94                if(not self.__history.exists(cap_atom.id)): 
     95                        for dev in self.__alert_devs: 
     96                                if(dev.isAlertWanted(cap_atom)): 
     97                                        if(not self.__simalert): 
     98                                                cap_atom.expand(self.simfetch,self.proxy) 
     99                                                self.logAtomFull(cap_atom) 
     100                                                dev.send(cap_atom) 
     101                                                self.__history.add(cap_atom.id) 
     102                                        else: 
     103                                                self.log.info("Simulated Alert on: %s" % cap_atom.id) 
     104                else: 
     105                        self.log.debug("Ignoring %s: Already alerted on" % cap_atom.id)