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

Unified Diff: filters/datesort.py

Issue 29334171: Issue 3410 - Added date sort / format for press releases (Closed)
Patch Set: Changing sort filters and utf8 charaters in release hrefs Created Feb. 2, 2016, 4:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | filters/humanize_dates.py » ('j') | filters/humanize_dates.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filters/datesort.py
diff --git a/filters/datesort.py b/filters/datesort.py
deleted file mode 100644
index 9d4c6479de4eaa0dd360520a4906eb7513f53021..0000000000000000000000000000000000000000
--- a/filters/datesort.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import datetime, random
-
-def datesort(value, basedate="1970-01-01", column=0):
- base = datetime.datetime.strptime(basedate, "%Y-%m-%d")
- def randdiff(entry):
- date = datetime.datetime.strptime(entry[column], "%Y-%m-%d")
- diff = (date - base).days
- return diff * 0.2 + random.randrange(diff) * 0.8
- return sorted(value, key=randdiff)
« no previous file with comments | « no previous file | filters/humanize_dates.py » ('j') | filters/humanize_dates.py » ('J')

Powered by Google App Engine
This is Rietveld