raise ValueError('Column name %s is invalid.' % o)\r
self._order_by = OrderByTuple(validated_order_by)\r
else:\r
- self._order_by = ()\r
+ self._order_by = OrderByTuple()\r
order_by = property(lambda s: s._order_by, _set_order_by)\r
\r
def __unicode__(self):\r
books.order_by = order\r
assert [b['id'] for b in books.rows] == result\r
\r
- # None is normalized to an empty tuple, ensuring iterability; it's\r
- # also the default value\r
+ # None is normalized to an empty order by tuple, ensuring iterability;\r
+ # it also supports all the cool methods that we offer for order_by.\r
+ # This is true for the default case...\r
assert books.order_by == ()\r
iter(books.order_by)\r
+ assert hasattr(books.order_by, 'reverse')\r
+ # ...as well as when explicitly set to None.\r
books.order_by = None\r
assert books.order_by == ()\r
iter(books.order_by)\r
+ assert hasattr(books.order_by, 'reverse')\r
\r
# test various orderings\r
test_order(('num_pages',), [1,3,2,4])\r