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

Side by Side Diff: sitescripts/urlfixer/web/submitData.py

Issue 29670611: Issue 5844 - Remove redundant parentheses in sitescripts and abpsembly (Closed) Base URL: https://hg.adblockplus.org/sitescripts/
Patch Set: Addressed the comments in /sitescripts Created Jan. 25, 2018, 4:12 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
« no previous file with comments | « sitescripts/templateFilters.py ('k') | sitescripts/utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if os.name == 'nt': 71 if os.name == 'nt':
72 return MySQLdb.connect(user=dbuser, passwd=dbpasswd, db=database, 72 return MySQLdb.connect(user=dbuser, passwd=dbpasswd, db=database,
73 use_unicode=True, charset='utf8', named_pipe=True ) 73 use_unicode=True, charset='utf8', named_pipe=True )
74 else: 74 else:
75 return MySQLdb.connect(user=dbuser, passwd=dbpasswd, db=database, 75 return MySQLdb.connect(user=dbuser, passwd=dbpasswd, db=database,
76 use_unicode=True, charset='utf8') 76 use_unicode=True, charset='utf8')
77 77
78 78
79 def _get_domain_id(db, domain): 79 def _get_domain_id(db, domain):
80 cursor = db.cursor(MySQLdb.cursors.DictCursor) 80 cursor = db.cursor(MySQLdb.cursors.DictCursor)
81 cursor.execute('SELECT id FROM domains WHERE domain = %s', (domain)) 81 cursor.execute('SELECT id FROM domains WHERE domain = %s', domain)
82 result = cursor.fetchone() 82 result = cursor.fetchone()
83 if result == None: 83 if result == None:
84 cursor.execute('INSERT INTO domains(domain) VALUES (%s)', (domain)) 84 cursor.execute('INSERT INTO domains(domain) VALUES (%s)', domain)
85 return db.insert_id() 85 return db.insert_id()
86 else: 86 else:
87 return result['id'] 87 return result['id']
88 88
89 89
90 def _increment_entry(db, domain_id, status): 90 def _increment_entry(db, domain_id, status):
91 cursor = db.cursor(MySQLdb.cursors.DictCursor) 91 cursor = db.cursor(MySQLdb.cursors.DictCursor)
92 cursor.execute('INSERT INTO corrections(domain, status, curr_month, prev_mon th, curr_year, prev_year) VALUES (%s, %s, %s, %s, %s, %s) ON DUPLICATE KEY UPDAT E curr_month = curr_month + 1, curr_year = curr_year + 1', (domain_id, status, 1 , 0, 1, 0)) 92 cursor.execute('INSERT INTO corrections(domain, status, curr_month, prev_mon th, curr_year, prev_year) VALUES (%s, %s, %s, %s, %s, %s) ON DUPLICATE KEY UPDAT E curr_month = curr_month + 1, curr_year = curr_year + 1', (domain_id, status, 1 , 0, 1, 0))
OLDNEW
« no previous file with comments | « sitescripts/templateFilters.py ('k') | sitescripts/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld