| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 # Not a page link | 34 # Not a page link |
| 35 return None, None | 35 return None, None |
| 36 | 36 |
| 37 if page == "" and url != "": | 37 if page == "" and url != "": |
| 38 # Page-relative link | 38 # Page-relative link |
| 39 return None, None | 39 return None, None |
| 40 | 40 |
| 41 config = self.read_config() | 41 config = self.read_config() |
| 42 default_locale = config.get("general", "defaultlocale") | 42 default_locale = config.get("general", "defaultlocale") |
| 43 default_page = config.get("general", "defaultpage") | 43 default_page = config.get("general", "defaultpage") |
| 44 alternative_page = "/".join([page, default_page]).lstrip("/") | 44 alternative_page = "/".join([page.rstrip("/"), default_page]).lstrip("/") |
| 45 | 45 |
| 46 if self.has_localizable_file(default_locale, page): | 46 if self.has_localizable_file(default_locale, page): |
| 47 if not self.has_localizable_file(locale, page): | 47 if not self.has_localizable_file(locale, page): |
| 48 locale = default_locale | 48 locale = default_locale |
| 49 elif self.has_page(page): | 49 elif self.has_page(page): |
| 50 if not self.has_locale(locale, page): | 50 if not self.has_locale(locale, page): |
| 51 locale = default_locale | 51 locale = default_locale |
| 52 elif self.has_page(alternative_page): | 52 elif self.has_page(alternative_page): |
| 53 if not self.has_locale(locale, alternative_page): | 53 if not self.has_locale(locale, alternative_page): |
| 54 locale = default_locale | 54 locale = default_locale |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 path = os.path.join(dir, filename) | 290 path = os.path.join(dir, filename) |
| 291 if os.path.isfile(path): | 291 if os.path.isfile(path): |
| 292 result.append(relpath + filename) | 292 result.append(relpath + filename) |
| 293 elif os.path.isdir(path): | 293 elif os.path.isdir(path): |
| 294 do_list(path, relpath + filename + "/") | 294 do_list(path, relpath + filename + "/") |
| 295 do_list(self.get_path(subdir), "") | 295 do_list(self.get_path(subdir), "") |
| 296 return result | 296 return result |
| 297 | 297 |
| 298 def get_cache_dir(self): | 298 def get_cache_dir(self): |
| 299 return os.path.join(self._dir, "cache") | 299 return os.path.join(self._dir, "cache") |
| OLD | NEW |