[core] Fix nested selection lists (#2750)

This commit is contained in:
Bocki 2022-05-25 09:38:53 +02:00 committed by GitHub
parent 462319344b
commit 7afc577e97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

10
.github/prtester.py vendored
View File

@ -1,4 +1,5 @@
import requests import requests
import itertools
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from datetime import datetime from datetime import datetime
import os.path import os.path
@ -47,15 +48,16 @@ def testBridges(bridges,status):
if parameter.get('type') == 'checkbox': if parameter.get('type') == 'checkbox':
if parameter.has_attr('checked'): if parameter.has_attr('checked'):
formstring = formstring + '&' + parameter.get('name') + '=on' formstring = formstring + '&' + parameter.get('name') + '=on'
for list in lists: for listing in lists:
selectionvalue = '' selectionvalue = ''
for selectionentry in list.contents: listingflat = list(itertools.chain.from_iterable(listing))
for selectionentry in listingflat:
if 'selected' in selectionentry.attrs: if 'selected' in selectionentry.attrs:
selectionvalue = selectionentry.get('value') selectionvalue = selectionentry.get('value')
break break
if selectionvalue == '': if selectionvalue == '':
selectionvalue = list.contents[0].get('value') selectionvalue = listingflat[0].get('value')
formstring = formstring + '&' + list.get('name') + '=' + selectionvalue formstring = formstring + '&' + listing.get('name') + '=' + selectionvalue
if not errormessages: if not errormessages:
# if all example/default values are present, form the full request string, run the request, replace the static css # if all example/default values are present, form the full request string, run the request, replace the static css
# file with the url of em's public instance and then upload it to termpad.com, a pastebin-like-site. # file with the url of em's public instance and then upload it to termpad.com, a pastebin-like-site.