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

Delta Between Two Patch Sets: cms/sources.py

Issue 30044555: Issue 7461 - Include source page into warning text for unresolved links (Closed) Base URL: https://hg.adblockplus.org/cms
Left Patch Set: Add tests Created April 12, 2019, 2:37 p.m.
Right Patch Set: Improve readability of the error message Created April 15, 2019, 4:48 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 | « cms/converters.py ('k') | tests/expected_output/common/en/sitemap » ('j') | 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-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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 locale = default_locale 52 locale = default_locale
53 elif self.has_page(page): 53 elif self.has_page(page):
54 if not self.has_locale(locale, page): 54 if not self.has_locale(locale, page):
55 locale = default_locale 55 locale = default_locale
56 elif self.has_page(alternative_page): 56 elif self.has_page(alternative_page):
57 if not self.has_locale(locale, alternative_page): 57 if not self.has_locale(locale, alternative_page):
58 locale = default_locale 58 locale = default_locale
59 elif self.has_static(page): 59 elif self.has_static(page):
60 locale = None 60 locale = None
61 else: 61 else:
62 logging.warning('Link to "%s" (from "%s") cannot be resolved', 62 logging.warning('Link from "%s" to "%s" cannot be resolved',
63 page, source_page) 63 source_page, page)
rhowell 2019/04/12 20:17:12 NIT: It might be slightly easier to read the error
Vasily Kuznetsov 2019/04/15 16:48:45 Yeah, makes sense. Done.
64 64
65 parts = page.split('/') 65 parts = page.split('/')
66 if parts[-1] == default_page: 66 if parts[-1] == default_page:
67 page = '/'.join(parts[:-1]) 67 page = '/'.join(parts[:-1])
68 if locale: 68 if locale:
69 path = '/{}/{}'.format(locale, page) 69 path = '/{}/{}'.format(locale, page)
70 return locale, urlparse.urlunparse(parsed[0:2] + (path,) + parsed[3: ]) 70 return locale, urlparse.urlunparse(parsed[0:2] + (path,) + parsed[3: ])
71 return locale, '/' + page 71 return locale, '/' + page
72 72
73 def read_config(self): 73 def read_config(self):
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 'read_config', 400 'read_config',
401 'read_template', 401 'read_template',
402 'read_locale', 402 'read_locale',
403 'read_file', 403 'read_file',
404 'read_include', 404 'read_include',
405 'exec_file', 405 'exec_file',
406 ]: 406 ]:
407 setattr(source, fname, utils.memoize(getattr(source, fname))) 407 setattr(source, fname, utils.memoize(getattr(source, fname)))
408 408
409 return source 409 return source
LEFTRIGHT

Powered by Google App Engine
This is Rietveld