refactoring

This commit is contained in:
frankknoll
2022-11-22 12:40:26 +01:00
parent 134a133da1
commit e87fe0c8ba
21 changed files with 692 additions and 731 deletions

View File

@@ -0,0 +1,21 @@
from bs4 import BeautifulSoup
class CountryOptionsSetter:
def setCountryOptions(self, html, options):
soup = self._setCountryOptions(self._parse(html), self._parseOptions(options))
return str(soup)
def _setCountryOptions(self, soup, options):
countrySelect = soup.find(id = "countrySelect")
countrySelect.clear()
for option in options:
countrySelect.append(option)
return soup
def _parseOptions(self, options):
return [self._parse(option).option for option in options]
def _parse(self, html):
return BeautifulSoup(html, 'lxml')