Changeset 177:e7e54a896aa3
- Timestamp:
- 11/26/08 03:40:55 (3 years ago)
- Author:
- cfreeze@…
- Branch:
- CAP_1.1
- Message:
-
clean up the execution device to actually be usable on the commandline
- Location:
- StormSiren
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r175
|
r177
|
|
| 78 | 78 | |
| 79 | 79 | def send(self,alert): |
| 80 | | subject = EMAIL_SUBJECT_LEADER + " - " + alert.headline + alert.getAreas() |
| | 80 | subject = EMAIL_SUBJECT_LEADER + " - " + alert.headline + " (" + alert.getAreas() + ")" |
| 81 | 81 | alert_body = "" |
| 82 | 82 | |
-
|
r122
|
r177
|
|
| 77 | 77 | def _execute(self,exe,alert): |
| 78 | 78 | try: |
| 79 | | subprocess.Popen([exe,alert.id,WeatherTypes.toString(alert.type),alert.state,alert.county]).wait() |
| 80 | | self.log.info("Executing: [%s %s %s %s %s]" % (exe,alert.id,WeatherTypes.toString(alert.type),alert.state,alert.county)) |
| | 79 | subprocess.Popen([exe,alert.id,"\"" + WeatherTypes.toString(alert.type) + "\"",alert.state,"\"" + alert.getAreas() + "\""]).wait() |
| | 80 | self.log.info("Executing: [%s %s %s %s %s]" % (exe,alert.id,"\"" + WeatherTypes.toString(alert.type) + "\"",alert.state,"\"" + alert.getAreas() + "\"")) |
| 81 | 81 | except os.error: |
| 82 | | self.log.error("Problem Executing: [%s %s %s %s %s]" % (exe,alert.id,WeatherTypes.toString(alert.type),alert.state,alert.county)) |
| | 82 | self.log.error("Problem Executing: [%s %s %s %s %s]" % (exe,alert.id,"\"" + WeatherTypes.toString(alert.type),alert.state,"\"" + alert.getAreas() + "\"")) |
| 83 | 83 | |
| 84 | 84 | class ExecutionAlertDeviceInfo(object): |
-
|
r175
|
r177
|
|
| 63 | 63 | |
| 64 | 64 | def getText(self): |
| 65 | | str = self.headline + "\n\n" |
| | 65 | str = self.headline + " (" + self.getAreas() + ")\n\n" |
| 66 | 66 | str += " Issued: " + self.issued + "\n" |
| 67 | 67 | str += "Expires: " + self.expires + "\n" |
| … |
… |
|
| 80 | 80 | |
| 81 | 81 | def getAreas(self): |
| 82 | | str = "(" |
| 83 | | str += string.join(self.areas,',') |
| 84 | | str += ")" |
| | 82 | str = string.join(self.areas,',') |
| 85 | 83 | return str |
| 86 | 84 | |
-
|
r122
|
r177
|
|
| 42 | 42 | """ |
| 43 | 43 | |
| | 44 | import string |
| | 45 | |
| 44 | 46 | UNKNOWN = 0 |
| 45 | 47 | WARNING = 1 |
| … |
… |
|
| 76 | 78 | wtypes.append("Alert") |
| 77 | 79 | |
| 78 | | return "(" + "|".join(wtypes) + ")" |
| | 80 | return string.join(wtypes,"|") |
| 79 | 81 | toString = staticmethod(toString) |
| 80 | 82 | |