[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

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.