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: Changed humanize_dates to format a single date and removed space before argument list Created Feb. 4, 2016, 10:03 a.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_date.py » ('j') | filters/humanize_date.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
index 9d4c6479de4eaa0dd360520a4906eb7513f53021..2d7f6ab4939571276b0c7706f2be7a8eed6e75cf 100644
--- a/filters/datesort.py
+++ b/filters/datesort.py
@@ -1,9 +1,2 @@
-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)
+def datesort(collection):
+ return sorted(collection, reverse=True)
« no previous file with comments | « no previous file | filters/humanize_date.py » ('j') | filters/humanize_date.py » ('J')

Powered by Google App Engine
This is Rietveld