Skip to content

Commit efd1dcf

Browse files
author
peakwinter
committed
allow filter Location by type
1 parent b0b0fa0 commit efd1dcf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

nginx/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def filter(self, btype='', name=''):
2424
for x in self.blocks:
2525
if name and isinstance(x, Key) and x.name == name:
2626
flist.append(x)
27+
elif isinstance(x, Container) and x.__class__.__name__ == btype and x.value == name:
28+
flist.append(x)
2729
elif not name and btype and x.__class__.__name__ == btype:
2830
flist.append(x)
2931
return flist
@@ -82,6 +84,8 @@ def filter(self, btype='', name=''):
8284
for x in self.blocks:
8385
if name and isinstance(x, Key) and x.name == name:
8486
flist.append(x)
87+
elif isinstance(x, Container) and x.__class__.__name__ == btype and x.value == name:
88+
flist.append(x)
8589
elif not name and btype and x.__class__.__name__ == btype:
8690
flist.append(x)
8791
return flist

0 commit comments

Comments
 (0)