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

Fix for getchildren() being deprecated... #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jss/jssobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _reset_data(self, updated_data):
"""Clear all children of base element and replace with update"""
self.clear()
# Convert all incoming data to PrettyElements.
for child in updated_data.getchildren():
for child in list(updated_data):
if not isinstance(child, PrettyElement):
child = PrettyElement(child)
self._children.append(child)
Expand Down Expand Up @@ -767,7 +767,7 @@ def add_object_to_path(self, obj, location):
"""
location = self._handle_location(location)
location.append(obj.as_list_data())
results = [item for item in location.getchildren() if
results = [item for item in list(location) if
item.findtext("id") == obj.id][0]
return results

Expand All @@ -782,10 +782,10 @@ def remove_object_from_list(self, obj, list_element):
list_element = self._handle_location(list_element)

if isinstance(obj, Container):
results = [item for item in list_element.getchildren() if
results = [item for item in list(list_element) if
item.findtext("id") == obj.id]
elif isinstance(obj, (int, string_types)):
results = [item for item in list_element.getchildren() if
results = [item for item in list(list_element) if
item.findtext("id") == str(obj) or
item.findtext("name") == obj]

Expand Down