Skip to content

Commit 0c9d532

Browse files
author
Lawrence D'Oliveiro
committed
GetManagedObjects handler should only return child objects of given base path
1 parent de6bc1a commit 0c9d532

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

ravel.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3480,8 +3480,9 @@ class ManagedObjectsHandler :
34803480
set_result_keyword = "set_result",
34813481
bus_keyword = "bus",
34823482
message_keyword = "message",
3483+
path_keyword = "base_path",
34833484
)
3484-
def get_managed_objects(self, bus, message, set_result) :
3485+
def get_managed_objects(self, bus, message, base_path, set_result) :
34853486

34863487
result = {}
34873488
to_await = []
@@ -3501,14 +3502,17 @@ async def await_propvalues() :
35013502
"returns supported interfaces and current property values for all" \
35023503
" currently-existent managed objects."
35033504
for path, interfaces in bus._managed_objects.items() :
3504-
obj_entry = {}
3505-
for interface_name in interfaces :
3506-
obj_entry[interface_name], await_props = bus._get_all_my_props(message, path, interface_name)
3507-
for propname, propvalue in await_props :
3508-
to_await.append((path, interface_name, propname, propvalue))
3505+
if base_path == "/" and path != "/" or path.startswith(base_path + "/") :
3506+
obj_entry = {}
3507+
for interface_name in interfaces :
3508+
obj_entry[interface_name], await_props = \
3509+
bus._get_all_my_props(message, path, interface_name)
3510+
for propname, propvalue in await_props :
3511+
to_await.append((path, interface_name, propname, propvalue))
3512+
#end for
35093513
#end for
3510-
#end for
3511-
result[path] = obj_entry
3514+
result[path] = obj_entry
3515+
#end if
35123516
#end for
35133517
if len(to_await) != 0 :
35143518
return_result = await_propvalues() # result will be available when this is done

0 commit comments

Comments
 (0)