coffeestats / coffeestats-django

Django port of https://coffeestats.org/ code
Other
9 stars 2 forks source link

submission fails if no date or time is set in request #13

Closed jandd closed 10 years ago

jandd commented 10 years ago

it is possible that due to timing issues the date and time fields in POST requests to the submit views are not set. This leads to an exception:

Traceback (most recent call last):
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 170, in post
    if form.is_valid():
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/forms/forms.py", line 129, in is_valid
    return self.is_bound and not bool(self.errors)
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/forms/forms.py", line 121, in errors
    self.full_clean()
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/forms/forms.py", line 274, in full_clean
    self._clean_form()
  File "/home/jan/.virtualenvs/coffeestats/local/lib/python2.7/site-packages/django/forms/forms.py", line 300, in _clean_form
    self.cleaned_data = self.clean()
  File "./caffeine/forms.py", line 164, in clean
    self.cleaned_data['date'], self.cleaned_data['time'])
KeyError: 'date'