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

Side by Side Diff: filters/subscription_sort.py

Issue 6265373108207616: Issue #1170 adblockplus.org migration from Anwiki to our CMS. (Closed)
Patch Set: Created Sept. 17, 2014, 8:22 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 | « filters/parse_interface.py ('k') | filters/unescape.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 def subscription_sort(value, prioritizeRecommended=True):
2 value = value[:] # create a copy of the list
3 if prioritizeRecommended:
4 value.sort(lambda a, b: (
5 cmp(a.get("type"), b.get("type")) or
6 cmp(a.get("deprecated"), b.get("deprecated")) or
7 cmp(b.get("catchall"), a.get("catchall")) or
8 cmp(b.get("recommendation") != None, a.get("recommendation") != None) or
9 cmp(a.get("name").lower(), b.get("name").lower())
10 ))
11 else:
12 value.sort(lambda a, b: (
13 cmp(a.get("type"), b.get("type")) or
14 cmp(a.get("deprecated"), b.get("deprecated")) or
15 cmp(a.get("name").lower(), b.get("name").lower())
16 ))
17 return value
OLDNEW
« no previous file with comments | « filters/parse_interface.py ('k') | filters/unescape.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld