| Index: sitescripts/notifications/parser.py |
| =================================================================== |
| --- a/sitescripts/notifications/parser.py |
| +++ b/sitescripts/notifications/parser.py |
| @@ -16,6 +16,8 @@ |
| # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| import codecs |
| +import datetime |
| +import dateutil.parser |
|
Sebastian Noack
2015/06/23 15:41:36
Nit: Third party module imports go below corelib i
Felix Dahlke
2015/06/23 15:51:43
Oh, didn't even realise it's third party... Done.
|
| import os |
| import re |
| import subprocess |
| @@ -87,6 +89,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) |
|
Sebastian Noack
2015/06/23 15:41:36
I wonder why we don't simply use a more simply for
Felix Dahlke
2015/06/23 15:51:43
Now that I know that dateutil is third party, it'd
Sebastian Noack
2015/06/23 15:58:38
IIRC, the initial idea was to serve one static fil
Wladimir Palant
2015/06/23 17:24:00
I don't think the idea was ever having this checke
Felix Dahlke
2015/06/24 07:53:16
I really don't think we want to parse ISO 8601 our
|
| else: |
| raise Exception("Unknown parameter '%s' in file '%s'" % (key, name)) |
| @@ -118,6 +122,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() |