Skip to content

Commit

Permalink
[traceback] KeyError: end (bug 633026)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkoberger committed Apr 27, 2011
1 parent 361c50e commit d8b92a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/editors/forms.py
Expand Up @@ -39,10 +39,10 @@ class EventLogForm(happyforms.Form):
def clean(self):
data = self.cleaned_data
# We want this to be inclusive of the end date.
if data['end']:
if 'end' in data and data['end']:
data['end'] += timedelta(days=1)

if data['filter']:
if 'filter' in data and data['filter']:
data['filter'] = ACTION_DICT[data['filter']]
return data

Expand All @@ -56,7 +56,7 @@ class ReviewLogForm(happyforms.Form):
def clean(self):
data = self.cleaned_data
# We want this to be inclusive of the end date.
if data['end']:
if 'end' in data and data['end']:
data['end'] += timedelta(days=1)

return data
Expand Down
14 changes: 14 additions & 0 deletions apps/editors/tests/test_views.py
Expand Up @@ -171,6 +171,20 @@ def test_end_filter(self):
eq_(len(doc('tbody tr').not_('.hide')), 50)
eq_(doc('tbody tr.hide').eq(0).text(), 'youwin')

def test_end_filter_wrong(self):
"""
Let's use today as an end-day filter and make sure we see stuff if we
filter.
"""
self.make_approvals()
date = 'wrong!'
r = self.client.get(reverse('editors.reviewlog') + '?end=' + date)
# If this is broken, we'll get a traceback.
eq_(r.status_code, 200)

doc = pq(r.content)
eq_(doc('#log-listing tr:not(.hide)').length, 51)

def test_breadcrumbs(self):
r = self.client.get(reverse('editors.reviewlog'))
doc = pq(r.content)
Expand Down

0 comments on commit d8b92a0

Please sign in to comment.