Skip to content

Commit e74dd34

Browse files
committed
Fix exception triggered by all_id* and 1id_* generating scripts when a document lacks creation date. Closes ietf-tools#371.
- Legacy-Id: 2501
1 parent 62c16cb commit e74dd34

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

ietf/idrfc/views_doc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ def _get_history(doc, versions):
180180
# convert plain dates to datetimes (required for sorting)
181181
for x in results:
182182
if not isinstance(x['date'], datetime):
183-
x['date'] = datetime.combine(x['date'], time(0,0,0))
183+
if x['date']:
184+
x['date'] = datetime.combine(x['date'], time(0,0,0))
185+
else:
186+
x['date'] = datetime(1970,1,1)
184187

185188
results.sort(key=lambda x: x['date'])
186189
results.reverse()

ietf/idtracker/templatetags/ietf_filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def stable_dictsort(value, arg):
368368
http://code.djangoproject.com/ticket/12110
369369
"""
370370
decorated = [(resolve_variable('var.' + arg, {'var' : item}), item) for item in value]
371-
decorated.sort(lambda a, b: cmp(a[0], b[0]))
371+
decorated.sort(lambda a, b: cmp(a[0], b[0]) if a[0] and b[0] else -1 if b[0] else 1 if a[0] else 0)
372372
return [item[1] for item in decorated]
373373

374374
def _test():

0 commit comments

Comments
 (0)