Index: modules/statsmaster/templates/anonymize_ips_head.erb |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/statsmaster/templates/anonymize_ips_head.erb |
@@ -0,0 +1,12 @@ |
+#!/usr/bin/env python |
+ |
+import sys |
+import os |
+import re |
+from datetime import datetime, timedelta |
+ |
+yearmonth = sys.argv[1] |
+if yearmonth == 'prevmonth': |
+ now = datetime.now() |
+ yearmonth = (now - timedelta(days=now.day)).strftime('%Y%m') |
+year, month = re.search(r'^(\d{4})(\d{2})$', yearmonth).groups() |