Skip to content

Commit

Permalink
Merge pull request #52 from VigneshVSV/subthing
Browse files Browse the repository at this point in the history
Subthing exposed with correct URL path
  • Loading branch information
VigneshVSV authored Dec 7, 2024
2 parents dea641f + bd84d55 commit 13f51c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ New:
- cookie auth & its specification in TD (cookie auth branch)
- adding custom handlers for each property, action and event to override default behaviour

Bug Fixes:
- composed sub`Thing`s exposed with correct URL path

## [v0.2.8] - 2024-12-06

- pydantic & JSON schema support for property models
- composed sub`Thing`s exposed with correct URL path

## [v0.2.7] - 2024-10-22

Expand Down
5 changes: 3 additions & 2 deletions hololinked/server/dataklasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,9 @@ def get_organised_resources(instance):
# second condition allows sharing of Things without adding once again to the list of exposed resources
# for example, a shared logger
continue
resource._owner = instance
resource._prepare_resources()
if resource._owner is None:
resource._owner = instance
resource._prepare_resources()
httpserver_resources.update(resource.httpserver_resources)
# zmq_resources.update(resource.zmq_resources)
instance_resources.update(resource.instance_resources)
Expand Down
11 changes: 8 additions & 3 deletions hololinked/server/td.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,7 @@ class ThingDescription(Schema):
'events', 'thing_description', 'GUI', 'object_info' ]

skip_actions = ['_set_properties', '_get_properties', '_add_property', '_get_properties_in_db',
'push_events', 'stop_events', 'get_postman_collection', 'get_thing_description',
'get_our_temp_thing_description']
'get_postman_collection', 'get_thing_description', 'get_our_temp_thing_description']

# not the best code and logic, but works for now

Expand Down Expand Up @@ -779,12 +778,18 @@ def add_interaction_affordances(self):
if (resource.obj_name == 'state' and (not hasattr(self.instance, 'state_machine') or
not isinstance(self.instance.state_machine, StateMachine))):
continue
if resource.obj_name not in self.instance.properties:
continue
self.properties[resource.obj_name] = PropertyAffordance.generate_schema(resource.obj,
self.instance, self.authority)

elif (resource.isaction and resource.obj_name not in self.actions and
resource.obj_name not in self.skip_actions and hasattr(resource.obj, '_remote_info')):


if resource.bound_obj != self.instance or (resource.obj_name == 'exit' and
self.instance._owner is not None) or (not hasattr(resource.bound_obj, 'db_engine') and
resource.obj_name == 'load_properties_from_DB'):
continue
self.actions[resource.obj_name] = ActionAffordance.generate_schema(resource.obj,
self.instance, self.authority)
except Exception as ex:
Expand Down

0 comments on commit 13f51c8

Please sign in to comment.