cqlengine/cqlengine — pull request #112 by pandu-rao (2013-10-04 01:47:35+00:00)
Title: Fixed bug with None value in Date, DateTime to_python conversion in columns.py

I found a potential issue with to_python conversion in the case of Date and DateTime conversion.

The bug occurs in this case:
1. The model has a DateTime field, say start_time = DateTime()
2. Somewhere in code you do this- values_list('start_time')
3. Now in columns.py, the Date, DateTime to_python simply calls datetime.utctimestamp(value) without checking if value is not None.
4. This throws an error (TypeError: a float is required) when the resulting queryset is iterated over.

The guards in this patch provide the correct behavior. They are similar to the guards used in Set, Map, List, etc.