Skip to content

Commit 7678e0c

Browse files
committed
add iter on a specific root tag in listAttrs
1 parent 754698b commit 7678e0c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plexapi/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,12 @@ def firstAttr(self, *attrs):
295295
if value is not None:
296296
return value
297297

298-
def listAttrs(self, data, attr, **kwargs):
298+
def listAttrs(self, data, attr, rtag=None, **kwargs):
299299
""" Return a list of values from matching attribute. """
300300
results = []
301+
# rtag to iter on a specific root tag
302+
if rtag:
303+
data = next(data.iter(rtag), [])
301304
for elem in data:
302305
kwargs['%s__exists' % attr] = True
303306
if self._checkAttrs(elem, **kwargs):

0 commit comments

Comments
 (0)