Skip to content

Commit

Permalink
Merge pull request #1970 from benfitzpatrick/rose-edit.fix-var-info
Browse files Browse the repository at this point in the history
rose edit: fix info dialog for variables
  • Loading branch information
oliver-sanders committed Aug 30, 2016
2 parents 932556a + 88e5906 commit a647264
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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

0 comments on commit a647264

Please sign in to comment.