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

Side by Side Diff: sitescripts/subscriptions/subscriptionParser.py

Issue 29811558: Issue 6754 - Support the "circumvention" type (Closed) Base URL: https://hg.adblockplus.org/sitescripts/
Patch Set: Created June 20, 2018, 12:19 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 | « no previous file | no next file » | 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 found = False 193 found = False
194 for key in group: 194 for key in group:
195 if self._data[key] != None: 195 if self._data[key] != None:
196 found = True 196 found = True
197 if not found: 197 if not found:
198 str = ', '.join(group) 198 str = ', '.join(group)
199 warn('None of the attributes %s present in %s' % (str, path)) 199 warn('None of the attributes %s present in %s' % (str, path))
200 200
201 if len(self.variants) == 0: 201 if len(self.variants) == 0:
202 warn('No list locations given in %s' % path) 202 warn('No list locations given in %s' % path)
203 if self.type not in ('ads', 'anti-adblock', 'other', 'malware', 'social' , 'privacy'): 203 if self.type not in ('ads', 'anti-adblock', 'circumvention', 'other', 'm alware', 'social', 'privacy'):
tlucas 2018/06/20 13:02:37 Nit: While adding or changing lines, please adhere
204 warn('Unknown type given in %s' % path) 204 warn('Unknown type given in %s' % path)
205 if self.digest != 'daily' and self.digest != 'weekly': 205 if self.digest != 'daily' and self.digest != 'weekly':
206 warn('Unknown digest frequency given in %s' % path) 206 warn('Unknown digest frequency given in %s' % path)
207 if not self.digestDay[0:3].lower() in weekdays: 207 if not self.digestDay[0:3].lower() in weekdays:
208 warn('Unknown digest day given in %s' % path) 208 warn('Unknown digest day given in %s' % path)
209 self.digestDay = 'wed' 209 self.digestDay = 'wed'
210 self.digestDay = weekdays[self.digestDay[0:3].lower()] 210 self.digestDay = weekdays[self.digestDay[0:3].lower()]
211 if self.recommendation is not None and self.type == 'ads' and not (self. languages and self.languages.strip()): 211 if self.recommendation is not None and self.type == 'ads' and not (self. languages and self.languages.strip()):
212 warn('Recommendation without languages in %s' % path) 212 warn('Recommendation without languages in %s' % path)
213 if len(self.supplements) == 0: 213 if len(self.supplements) == 0:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 def getFallbackData(): 265 def getFallbackData():
266 repo = os.path.abspath(get_config().get('subscriptions', 'repository')) 266 repo = os.path.abspath(get_config().get('subscriptions', 'repository'))
267 redirectdata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'defa ult', os.path.join(repo, 'redirects')]) 267 redirectdata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'defa ult', os.path.join(repo, 'redirects')])
268 gonedata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'default' , os.path.join(repo, 'gone')]) 268 gonedata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'default' , os.path.join(repo, 'gone')])
269 return (redirectdata, gonedata) 269 return (redirectdata, gonedata)
270 270
271 271
272 def _validate_URL(url): 272 def _validate_URL(url):
273 parse_result = urlparse(url) 273 parse_result = urlparse(url)
274 return parse_result.scheme in ('http', 'https') and parse_result.netloc != ' ' 274 return parse_result.scheme in ('http', 'https') and parse_result.netloc != ' '
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld