Index: sitescripts/notifications/parser.py |
=================================================================== |
--- a/sitescripts/notifications/parser.py |
+++ b/sitescripts/notifications/parser.py |
@@ -16,6 +16,7 @@ |
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
import codecs |
+import datetime |
import os |
import re |
import subprocess |
@@ -23,6 +24,8 @@ |
import traceback |
from StringIO import StringIO |
+import dateutil.parser |
+ |
from sitescripts.utils import get_config |
def _parse_targetspec(value, name): |
@@ -87,6 +90,8 @@ |
current["targets"] = [target] |
elif key == "sample" and is_variant: |
current["sample"] = float(value) |
+ elif key in ["start", "end"]: |
+ current[key] = dateutil.parser.parse(value) |
else: |
raise Exception("Unknown parameter '%s' in file '%s'" % (key, name)) |
@@ -118,6 +123,11 @@ |
notification = _parse_notification(data, name) |
if "inactive" in notification: |
continue |
+ current_time = datetime.datetime.now() |
+ if "start" in notification and current_time < notification["start"]: |
+ continue |
+ if "end" in notification and current_time > notification["end"]: |
+ continue |
notifications.append(notification) |
except: |
traceback.print_exc() |