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

Unified Diff: sitescripts/reports/bin/processReports.py

Issue 5185987562962944: #240 - Remove carriage return characters (CR/LF => LF) (Closed)
Patch Set: Created Aug. 14, 2014, 7:11 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/reports/bin/processReports.py
===================================================================
--- a/sitescripts/reports/bin/processReports.py
+++ b/sitescripts/reports/bin/processReports.py
@@ -1,5 +1,5 @@
-# coding: utf-8
-
+# coding: utf-8
+
# This file is part of the Adblock Plus web scripts,
# Copyright (C) 2006-2014 Eyeo GmbH
#
@@ -14,36 +14,36 @@
#
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
-
-import MySQLdb, hashlib, sys, os, re
-from time import time
-from email.utils import parseaddr
-from sitescripts.utils import get_config, get_template, setupStderr
-from sitescripts.reports.utils import getReport, saveReport, get_db, executeQuery
-
-def getReports():
- count = 1000
- offset = 0
- while True:
- cursor = get_db().cursor(MySQLdb.cursors.DictCursor)
- executeQuery(cursor,
- '''SELECT guid FROM #PFX#reports WHERE hasscreenshot > 0 LIMIT %s OFFSET %s''',
- (count, offset))
- rows = cursor.fetchall()
- cursor.close()
- if len(rows) == 0:
- break
- for row in rows:
- yield row
- offset += len(rows)
-
-def processReports():
- for report in getReports():
- guid = report.get('guid', None)
- reportData = getReport(guid)
- if 'screenshot' in reportData:
- saveReport(guid, reportData)
-
-if __name__ == '__main__':
- setupStderr()
- processReports()
+
+import MySQLdb, hashlib, sys, os, re
+from time import time
+from email.utils import parseaddr
+from sitescripts.utils import get_config, get_template, setupStderr
+from sitescripts.reports.utils import getReport, saveReport, get_db, executeQuery
+
+def getReports():
+ count = 1000
+ offset = 0
+ while True:
+ cursor = get_db().cursor(MySQLdb.cursors.DictCursor)
+ executeQuery(cursor,
+ '''SELECT guid FROM #PFX#reports WHERE hasscreenshot > 0 LIMIT %s OFFSET %s''',
+ (count, offset))
+ rows = cursor.fetchall()
+ cursor.close()
+ if len(rows) == 0:
+ break
+ for row in rows:
+ yield row
+ offset += len(rows)
+
+def processReports():
+ for report in getReports():
+ guid = report.get('guid', None)
+ reportData = getReport(guid)
+ if 'screenshot' in reportData:
+ saveReport(guid, reportData)
+
+if __name__ == '__main__':
+ setupStderr()
+ processReports()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld