uri-mog / prettytable

Automatically exported from code.google.com/p/prettytable
Other
0 stars 0 forks source link

sortby misdocumented #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Wiki says that sortby behaviour can be swich off by setting it to None:

The behaviour will persist until you turn it off: 
x.sortby = None

But this raises an error:

In [57]: x.sortby = None
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-57-8471354fb9c4> in <module>()
----> 1 x.sortby = None

/usr/lib/python2.7/site-packages/prettytable.pyc in _set_sortby(self, val)
    373         return self._sortby
    374     def _set_sortby(self, val):
--> 375         self._validate_option("sortby", val)
    376         self._sortby = val
    377     sortby = property(_get_sortby, _set_sortby)

/usr/lib/python2.7/site-packages/prettytable.pyc in _validate_option(self, 
option, val)
    202             self._validate_nonnegative_int(option, val)
    203         elif option in ("sortby"):
--> 204             self._validate_field_name(option, val)
    205         elif option in ("sort_key"):
    206             self._validate_function(option, val)

/usr/lib/python2.7/site-packages/prettytable.pyc in _validate_field_name(self, 
name, val)
    278             assert val in self._field_names
    279         except AssertionError:
--> 280             raise Exception("Invalid field name: %s!" % val)
    281 
    282     def _validate_all_field_names(self, name, val):

Exception: Invalid field name: None!

Original issue reported on code.google.com by tucky.k...@gmail.com on 29 Oct 2012 at 9:02

GoogleCodeExporter commented 8 years ago
Thanks for reporting this!  While the documentation is currently wrong, it 
describes the way that *things* should work, so I will change the code in the 
next release.

Original comment by luke@maurits.id.au on 31 Oct 2012 at 6:00

GoogleCodeExporter commented 8 years ago
This has been fixed in trunk, so the correct behaviour will be seen in 0.7, 
which I am hoping to release later today.

Original comment by luke@maurits.id.au on 21 Jan 2013 at 10:11