Changeset 187:b82b5be8e615 for StormSiren/AlertDevice.py
- Timestamp:
- 11/28/08 18:18:12 (3 years ago)
- Branch:
- default
- Parents:
- 186:fdaf10ceded4 (diff), 183:1e15754ebd2a (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. - Files:
-
- 2 modified
-
StormSiren/AlertDevice.py (modified) (1 diff)
-
StormSiren/AlertDevice.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
StormSiren/AlertDevice.py
r170 r187 59 59 self.log = logging.getLogger('AlertDevice') 60 60 61 self.log.setLevel(logging.INFO) 61 62 self.__parse_weather_types(alerts) 62 63 self.__parse_areas(areas) -
StormSiren/AlertDevice.py
r184 r187 136 136 return False 137 137 138 def is CountyWanted(self,state,county):138 def isAreaWanted(self,state,alert_areas): 139 139 if(self.__areas.has_key(state)): 140 if(county.lower() in self.__areas[state]): 141 return True 140 for area in alert_areas: 141 self.log.debug("checking if %s is in (%s)" % (area.lower(),self.__areas[state])) 142 if(area.lower() in self.__areas[state]): 143 self.log.debug("%s IS IN (%s)" % (area.lower(),self.__areas[state])) 144 return True 142 145 return False 143 146 … … 146 149 if(self.isTypeWanted(cap_alert.type) and self.isStateWanted(cap_alert.state)): 147 150 self.log.debug("Testing[%s]: type and state match(%s/%i)" % (cap_alert.id, cap_alert.state, cap_alert.type)) 148 if(self.is CountyWanted(cap_alert.state, cap_alert.county)):149 self.log. info("Alert hit on county[%s/%s]: %s" % (cap_alert.county, cap_alert.state, cap_alert.id))151 if(self.isAreaWanted(cap_alert.state, cap_alert.areas)): 152 self.log.debug("Alert hit on area[%s/%s]: %s" % (cap_alert.state, cap_alert.id, cap_alert.areas)) 150 153 return True 151 154 else: 152 for loc in self.__areas[cap_alert.state]: 153 if(cap_alert.isLocationInDesc(loc)): 154 self.log.info("Alert hit on location[%s/%s]: %s" % (loc, cap_alert.state, cap_alert.id)) 155 return True 155 self.log.debug("Testing[%s]: alert not in watched area(%s/%s)" % (cap_alert.id, cap_alert.state, cap_alert.areas)) 156 else: 157 self.log.debug("Testing[%s]: Either wrong type or state (%s/%i)" % (cap_alert.id, cap_alert.state, cap_alert.type)) 156 158 return False 157 159 #CODE END
