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

Side by Side Diff: cms/converters.py

Issue 29994576: Noissue - Use flake8's built-in per-file-ignores and work around pep8-naming bug (Closed) Base URL: https://hg.adblockplus.org/cms/
Patch Set: Created Feb. 1, 2019, 12:12 a.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 | tox.ini » ('j') | 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 for filter_name, filter_value in filters.items(): 544 for filter_name, filter_value in filters.items():
545 if filter_name not in metadata: 545 if filter_name not in metadata:
546 return False 546 return False
547 if isinstance(metadata[filter_name], list): 547 if isinstance(metadata[filter_name], list):
548 if isinstance(filter_value, basestring): 548 if isinstance(filter_value, basestring):
549 filter_value = [filter_value] 549 filter_value = [filter_value]
550 for option in filter_value: 550 for option in filter_value:
551 if str(option) not in metadata[filter_name]: 551 if str(option) not in metadata[filter_name]:
552 return False 552 return False
553 elif filter_value != metadata[filter_name]: 553 elif filter_value != metadata[filter_name]:
554 return False 554 return False
555 return True 555 return True
556 556
557 def get_canonical_url(self, page): 557 def get_canonical_url(self, page):
558 """Return canonical URL for the page (without locale code)""" 558 """Return canonical URL for the page (without locale code)"""
559 try: 559 try:
560 base_url = self._params['site_url'] 560 base_url = self._params['site_url']
561 except KeyError: 561 except KeyError:
562 raise Exception('You must configure `siteurl` to use' 562 raise Exception('You must configure `siteurl` to use'
563 '`get_canonical_url()`') 563 '`get_canonical_url()`')
564 564
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 if self.page_has_locale(page, locale) or redirect: 599 if self.page_has_locale(page, locale) or redirect:
600 return self._params['source'].resolve_link(page, locale)[1] 600 return self._params['source'].resolve_link(page, locale)[1]
601 raise Exception('{} does not exist in {}'.format(page, locale)) 601 raise Exception('{} does not exist in {}'.format(page, locale))
602 602
603 603
604 converters = { 604 converters = {
605 'html': RawConverter, 605 'html': RawConverter,
606 'md': MarkdownConverter, 606 'md': MarkdownConverter,
607 'tmpl': TemplateConverter, 607 'tmpl': TemplateConverter,
608 } 608 }
OLDNEW
« no previous file with comments | « no previous file | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld