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

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

Issue 29464559: #1538 - Remove class statsmaster and associated resources (Closed)
Patch Set: Created June 13, 2017, 9:43 a.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 file = os.path.join('/var/www/awstatsdata', '<%= title %>',
2 'awstats%s%s.%s.txt' % (month, year, '<%= title %>'))
3 if os.path.exists(file):
4 with open(file, 'rb+') as f:
5 mapstarted = False
6 seekpos = None
7 for line in f:
8 if not mapstarted:
9 if line.startswith('BEGIN_MAP '):
10 mapstarted = True
11 else:
12 match = re.search(r'^POS_VISITOR (\d+)', line)
13 if match:
14 seekpos = int(match.group(1))
15 break
16
17 f.seek(seekpos)
18 data = f.readline() # BEGIN_VISITOR line
19 for line in f:
20 if line.startswith("END_VISITOR"):
21 break
22 parts = line.split(' ')
23 parts[0] = re.sub(r'\w', 'x', parts[0])
24 data += ' '.join(parts)
25
26 f.seek(seekpos)
27 f.write(data)
OLDNEW

Powered by Google App Engine
This is Rietveld