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

rose edit: fix info dialog for variables #1970

Merged
merged 1 commit into from Aug 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/python/rose/config_editor/util.py
Expand Up @@ -117,7 +117,11 @@ def launch_node_info_dialog(node, changes, search_function):
text += (rose.config_editor.DIALOG_NODE_INFO_CHANGES.format(changes) +
"\n")
text += rose.config_editor.DIALOG_NODE_INFO_DATA
att_list = vars(node).items()
try:
att_list = vars(node).items()
except TypeError:
# vars will fail when __slots__ are used.
att_list = node.getattrs()
att_list.sort()
att_list.sort(lambda x, y: (y[0] in ['name', 'value']) -
(x[0] in ['name', 'value']))
Expand Down
7 changes: 7 additions & 0 deletions lib/python/rose/variable.py
Expand Up @@ -127,6 +127,13 @@ def copy(self):
new_variable.old_value = self.old_value
return new_variable

def getattrs(self):
"""Return a list of attributes and values."""
attrs = []
for name in self.__slots__:
attrs.append((name, getattr(self, name)))
return attrs

def __repr__(self):
text = '<rose.variable :- name: ' + self.name + ', value: '
text += (
Expand Down