You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also, the handled options should have their value checked, and not just fail when they are in the process of being drawn on the screen.
The right solution imoh is by introducing infrastructure for "option dictionaries with validation". I made a simple version for the display preferences, for example
sage: from sage.repl.rich_output.preferences import DisplayPreferences
sage: d = DisplayPreferences(text='latex')
sage: d
Display preferences:
* graphics is not specified
* text = latex
sage: d.text
'latex'
sage: d.text = 'coocoo'
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-12-45e65af2b5e2> in <module>()
----> 1 d.text = 'coocoo'
/home/vbraun/Code/sage/local/lib/python2.7/site-packages/sage/repl/rich_output/preferences.pyc in setter(self, prefs, value)
230 if value not in allowed:
231 raise ValueError('value must be unset (None) or one of {0}, got {1}'
--> 232 .format(allowed, value))
233 setattr(prefs, self.underscore_name, value)
234
ValueError: value must be unset (None) or one of ('plain', 'ascii_art', 'latex'), got coocoo
sage: d.heyhey
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-2956b69fb951> in <module>()
----> 1 d.heyhey
AttributeError: 'DisplayPreferences' object has no attribute 'heyhey'
See the discussion at #18238 - there are several options for dealing with things like
show
Anyway, this ticket is about resolving this issue, which has been around since at least 6.4.1 and probably much longer.
CC: @egourgoulhon
Component: graphics
Issue created by migration from https://trac.sagemath.org/ticket/18245
The text was updated successfully, but these errors were encountered: