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

Delta Between Two Patch Sets: cms/sources.py

Issue 29376948: Noissue - Adding support for tel link scheme in Source.resolve_link of CMS (Closed) Base URL: https://hg.adblockplus.org/cms
Left Patch Set: Address my own feedback Created Feb. 24, 2017, 2:07 p.m.
Right Patch Set: Specify Python version in the comment Created Feb. 24, 2017, 4:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 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 16 matching lines...) Expand all
27 27
28 class Source: 28 class Source:
29 def resolve_link(self, url, locale): 29 def resolve_link(self, url, locale):
30 parsed = urlparse.urlparse(url) 30 parsed = urlparse.urlparse(url)
31 page = parsed.path 31 page = parsed.path
32 if parsed.scheme != '' or page.startswith('/') or page.startswith('.'): 32 if parsed.scheme != '' or page.startswith('/') or page.startswith('.'):
33 # Not a page link 33 # Not a page link
34 return None, None 34 return None, None
35 35
36 if url.startswith('tel:'): 36 if url.startswith('tel:'):
37 # Workaround for 'tel' scheme not recognized on some platforms. 37 # Workaround for 'tel' scheme not recognized in Python <=2.7.3.
Sebastian Noack 2017/02/24 14:32:08 If this is related to the Python version, as you s
Vasily Kuznetsov 2017/02/24 16:48:09 Done.
38 return None, None 38 return None, None
39 39
40 if page == '' and url != '': 40 if page == '' and url != '':
41 # Page-relative link 41 # Page-relative link
42 return None, None 42 return None, None
43 43
44 config = self.read_config() 44 config = self.read_config()
45 default_locale = config.get('general', 'defaultlocale') 45 default_locale = config.get('general', 'defaultlocale')
46 default_page = config.get('general', 'defaultpage') 46 default_page = config.get('general', 'defaultpage')
47 alternative_page = '/'.join([page.rstrip('/'), default_page]).lstrip('/' ) 47 alternative_page = '/'.join([page.rstrip('/'), default_page]).lstrip('/' )
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 path = os.path.join(dir, filename) 296 path = os.path.join(dir, filename)
297 if os.path.isfile(path): 297 if os.path.isfile(path):
298 result.append(relpath + filename) 298 result.append(relpath + filename)
299 elif os.path.isdir(path): 299 elif os.path.isdir(path):
300 do_list(path, relpath + filename + '/') 300 do_list(path, relpath + filename + '/')
301 do_list(self.get_path(subdir), '') 301 do_list(self.get_path(subdir), '')
302 return result 302 return result
303 303
304 def get_cache_dir(self): 304 def get_cache_dir(self):
305 return os.path.join(self._dir, 'cache') 305 return os.path.join(self._dir, 'cache')
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld