Skip to content

Commit 3a99d71

Browse files
authored
Merge pull request #83 from joapuiib/fix/soup-deprecation-warning
Fix: Deprecation warning soup findAll()
2 parents 54bd051 + a025c88 commit 3a99d71

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

encryptcontent/plugin.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def __encrypt_text__(self, text, key):
274274

275275
def __encrypt_content__(self, content, base_path, encryptcontent_path, encryptcontent):
276276
""" Replaces page or article content with decrypt form. """
277-
277+
278278
# optionally selfhost cryptojs
279279
js_libraries = []
280280
if not self.config['webcrypto']:
@@ -644,13 +644,13 @@ def on_config(self, config, **kwargs):
644644
storage_file = self.setup['config_path'].joinpath(self.config['additional_storage_file'])
645645
with open(storage_file, 'r') as stream:
646646
self.setup['additional_storage'] = yaml_load(stream)
647-
647+
648648
#init empty if missing
649649
if 'userpass' not in self.setup['additional_storage']:
650650
self.setup['additional_storage']['userpass'] = {}
651651
if 'password' not in self.setup['additional_storage']:
652652
self.setup['additional_storage']['password'] = {}
653-
653+
654654
for entry in self.setup['keystore'].copy():
655655
if entry[0] == KS_PASSWORD:
656656
if entry[1] in self.setup['additional_storage']['password']:
@@ -884,7 +884,7 @@ def on_page_markdown(self, markdown, page, config, **kwargs):
884884
self.setup['sharelinks'][page.url] = ('', credentials)
885885
elif page.encryptcontent.get('obfuscate'):
886886
self.setup['sharelinks'][page.url] = ('', page.encryptcontent['obfuscate'])
887-
887+
888888

889889
return markdown
890890

@@ -999,12 +999,12 @@ def on_page_context(self, context, page, config, **kwargs):
999999
if 'encryption_info_message' not in page.encryptcontent:
10001000
page.encryptcontent['encryption_info_message'] = self.config['encryption_info_message']
10011001

1002-
if page.encryptcontent['title_prefix']:
1002+
if page.encryptcontent['title_prefix']:
10031003
page.title = str(self.config['title_prefix']) + str(page.title)
10041004

10051005
if 'html_to_encrypt' in page.encryptcontent:
10061006
page.content = self.__encrypt_content__(
1007-
page.encryptcontent['html_to_encrypt'],
1007+
page.encryptcontent['html_to_encrypt'],
10081008
context['base_url']+'/',
10091009
self.setup['site_path']+page.url,
10101010
page.encryptcontent
@@ -1013,7 +1013,7 @@ def on_page_context(self, context, page, config, **kwargs):
10131013

10141014
if 'inject' in page.encryptcontent:
10151015
page.encryptcontent['decrypt_form'] = self.__encrypt_content__(
1016-
'<!-- dummy -->',
1016+
'<!-- dummy -->',
10171017
context['base_url']+'/',
10181018
self.setup['site_path']+page.url,
10191019
page.encryptcontent
@@ -1038,13 +1038,13 @@ def on_post_page(self, output_content, page, config, **kwargs):
10381038
encrypted_something = {**page.encryptcontent['inject'], **self.config['encrypted_something']}
10391039
else:
10401040
encrypted_something = self.config['encrypted_something']
1041-
1041+
10421042
if (encrypted_something and hasattr(page, 'encryptcontent')
10431043
and len(encrypted_something) > 0): # noqa: W503
10441044
soup = BeautifulSoup(output_content, 'html.parser')
10451045
for name, tag in encrypted_something.items():
10461046
# logger.debug({'name': name, 'html tag': tag[0], 'type': tag[1]})
1047-
something_search = soup.findAll(tag[0], {tag[1]: name})
1047+
something_search = soup.find_all(tag[0], {tag[1]: name})
10481048
if something_search is not None and len(something_search) > 0:
10491049
# Loop for multi child tags on target element
10501050
for item in something_search:
@@ -1107,7 +1107,7 @@ def on_post_build(self, config, **kwargs):
11071107
11081108
:param config: global configuration object
11091109
"""
1110-
1110+
11111111
Path(config.data["site_dir"] + '/assets/javascripts/').mkdir(parents=True, exist_ok=True)
11121112
decrypt_js_path = Path(config.data["site_dir"]).joinpath('assets/javascripts/decrypt-contents.js')
11131113
with open(decrypt_js_path, "w") as file:

0 commit comments

Comments
 (0)