| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| LEFT | RIGHT |