Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/statsmaster/templates/build_static_head.erb

Issue 6293281981857792: Issue 239 - Move AWStats processing to the stats server (Closed)
Patch Set: Created April 23, 2014, 1:14 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
Felix Dahlke 2014/04/25 04:37:08 Why is this a template? Seems to me like it could
Wladimir Palant 2014/04/25 07:40:55 Sure, it can be a static file - it's merely a temp
Felix Dahlke 2014/04/25 09:42:50 Fair enough.
2
3 import subprocess, sys, os, re
Felix Dahlke 2014/04/25 04:37:08 Should be one import per package, according to PEP
4 from datetime import datetime, timedelta
5
6 if len(sys.argv) > 1:
7 yearmonth = sys.argv[1]
8 if yearmonth == 'prevmonth':
9 now = datetime.now()
10 yearmonth = (now - timedelta(days=now.day)).strftime('%Y%m')
11 year, month = re.search(r'^(\d{4})(\d{2})$', yearmonth).groups()
12 dirtemplate = os.path.join('/var/www/awstats/archive/%s', yearmonth)
13 additional_params = ['-month=%s' % month, '-year=%s' % year]
14 else:
15 dirtemplate = '/var/www/awstats/%s'
16 additional_params = []
OLDNEW

Powered by Google App Engine
This is Rietveld