summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/minimaws/lib/wsgiserve.py
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-12-19 14:50:59 +1100
committer Vas Crabb <vas@vastheman.com>2019-12-19 14:50:59 +1100
commit9334bf4eae425551b8a575ed5a345b2b43dae42f (patch)
treed18e432658b5ca3a61dfbf0a77a34628d173e388 /scripts/minimaws/lib/wsgiserve.py
parente665b95e65f853b4a82e75f55ac354035852d41f (diff)
minimaws: display software lists for selected slot options on machine pages
Diffstat (limited to 'scripts/minimaws/lib/wsgiserve.py')
-rw-r--r--scripts/minimaws/lib/wsgiserve.py38
1 files changed, 22 insertions, 16 deletions
diff --git a/scripts/minimaws/lib/wsgiserve.py b/scripts/minimaws/lib/wsgiserve.py
index 8312b6f66fe..e77bb3f637f 100644
--- a/scripts/minimaws/lib/wsgiserve.py
+++ b/scripts/minimaws/lib/wsgiserve.py
@@ -133,9 +133,7 @@ class QueryPageHandler(HandlerBase):
def slot_data(self, machine):
result = { 'defaults': { }, 'slots': { } }
- # get defaults and slot options
- for slot, default in self.dbcurs.get_slot_defaults(machine):
- result['defaults'][slot] = default
+ # get slot options
prev = None
for slot, option, shortname, description in self.dbcurs.get_slot_options(machine):
if slot != prev:
@@ -147,12 +145,17 @@ class QueryPageHandler(HandlerBase):
prev = slot
options[option] = { 'device': shortname, 'description': description }
- # remove slots that come from default cards in other slots
- for slot in tuple(result['slots'].keys()):
- slot += ':'
- for candidate in tuple(result['slots'].keys()):
- if candidate.startswith(slot):
- del result['slots'][candidate]
+ # if there are any slots, get defaults
+ if result['slots']:
+ for slot, default in self.dbcurs.get_slot_defaults(machine):
+ result['defaults'][slot] = default
+
+ # remove slots that come from default cards in other slots
+ for slot in tuple(result['slots'].keys()):
+ slot += ':'
+ for candidate in tuple(result['slots'].keys()):
+ if candidate.startswith(slot):
+ del result['slots'][candidate]
return result
@@ -171,11 +174,12 @@ class QueryPageHandler(HandlerBase):
'unsupported': softwarelist['unsupported'] }
# remove software lists that come from default cards in slots
- for slot, default in self.dbcurs.get_slot_defaults(machine):
- slot += ':'
- for candidate in tuple(result.keys()):
- if candidate.startswith(slot):
- del result[candidate]
+ if result:
+ for slot, default in self.dbcurs.get_slot_defaults(machine):
+ slot += ':'
+ for candidate in tuple(result.keys()):
+ if candidate.startswith(slot):
+ del result[candidate]
return result
@@ -305,6 +309,7 @@ class MachineHandler(QueryPageHandler):
for softwarelist in self.dbcurs.get_machine_softwarelists(id):
total = softwarelist['total']
yield htmltmpl.MACHINE_SOFTWARELISTS_TABLE_ROW.substitute(
+ rowid=cgi.escape(softwarelist['tag'].replace(':', '-'), True),
href=self.softwarelist_href(softwarelist['shortname']),
shortname=cgi.escape(softwarelist['shortname']),
description=cgi.escape(softwarelist['description']),
@@ -368,8 +373,9 @@ class MachineHandler(QueryPageHandler):
haveextra.add(carddev)
cardid = self.dbcurs.get_machine_id(carddev)
carddev = self.sanitised_json(carddev)
- yield (' bios_sets[%s] = %s;\n' % (carddev, self.sanitised_json(self.bios_data(cardid)))).encode('utf-8')
- yield (' machine_flags[%s] = %s;\n' % (carddev, self.sanitised_json(self.flags_data(cardid)))).encode('utf-8')
+ yield (
+ ' bios_sets[%s] = %s;\n machine_flags[%s] = %s;\n softwarelist_info[%s] = %s;\n' %
+ (carddev, self.sanitised_json(self.bios_data(cardid)), carddev, self.sanitised_json(self.flags_data(cardid)), carddev, self.sanitised_json(self.softwarelist_data(cardid)))).encode('utf-8')
yield htmltmpl.MACHINE_SLOTS_PLACEHOLDER_EPILOGUE.substitute(
machine=self.sanitised_json(self.shortname)).encode('utf=8')