Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sortby misdocumented #19

Closed
GoogleCodeExporter opened this issue Sep 1, 2015 · 2 comments
Closed

sortby misdocumented #19

GoogleCodeExporter opened this issue Sep 1, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant