Skip to content

Commit 6404186

Browse files
author
btgoodwin
committed
Restored _application_externalProps to expose all properties
Waveform property lists will now include the assembly controller properties as well as anything listed in the external properties. Previous commit's removal of this mechanism was actually because it was bugged to appear to be the same as _getPropertySet since the method wasn't modifying the emitted property IDs to the external IDs, which were then filtered out when compared with app.query([]).
1 parent 579f4af commit 6404186

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

model/redhawk.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,37 @@ def release_application(self, domain_name, app_id):
193193
@background_task
194194
def application_configure(self, domain_name, app_id, new_properties):
195195
app = self._get_application(domain_name, app_id)
196-
props = app._getPropertySet()
196+
props = Redhawk._application_externalProps(app)
197197
changes = Redhawk._get_prop_changes(props, new_properties)
198198
return app.configure(changes)
199199

200+
'''
201+
Helper function to streamline getting a property list similar to what one
202+
gets from components, devices, etc. This can duplicate external properties
203+
listed by the assembly controller in the event the user wants to make some
204+
external under a namespaced ID.
205+
'''
206+
@staticmethod
207+
def _application_externalProps(app):
208+
props = app._getPropertySet()
209+
for epid, t in app._externalProps.iteritems():
210+
pid = t[0] # First item is the property id relative to the component
211+
cid = t[1] # Second item in tuple is prefix of component identifier
212+
log.app_log.debug('Looking for {}: {}'.format(cid, pid))
213+
for comp in app.comps:
214+
if comp.identifier.split(':')[0] == cid:
215+
log.app_log.debug('Found component')
216+
for prop in comp._properties:
217+
log.app_log.debug('Checking {} == {}'.format(prop.id, pid))
218+
if prop.id == pid:
219+
prop.id = epid;
220+
props.append(prop)
221+
log.app_log.debug('Found external property {} -> {}'.format(epid, pid))
222+
break;
223+
break;
224+
log.app_log.debug('All properties: {}'.format(props))
225+
return props
226+
200227
##############################
201228
# COMMON PROPERTIES
202229
'''

rest/application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get(self, domain_name, app_id=None):
3838
if app_id:
3939
app = yield self.redhawk.get_application(domain_name, app_id)
4040
comps = yield self.redhawk.get_component_list(domain_name, app_id)
41-
props = app._getPropertySet()
41+
props = self.redhawk._application_externalProps(app)
4242

4343
info = {
4444
'id': app._get_identifier(),
@@ -120,7 +120,7 @@ class ApplicationProperties(JsonHandler, PropertyHelper):
120120
def get(self, domain, app_id):
121121
try:
122122
app = yield self.redhawk.get_application(domain, app_id)
123-
props = app._getPropertySet()
123+
props = self.redhawk._application_externalProps(app)
124124

125125
self._render_json({
126126
'properties': self.format_properties(props, app.query([]))

0 commit comments

Comments
 (0)