From 2a9cce9841cf3304be114d9eafec21774f8f572a Mon Sep 17 00:00:00 2001 From: autodeploy <benoit@startinblox.com> Date: Sun, 23 Jun 2024 20:18:39 +0200 Subject: [PATCH] fix: style --- djangoldp/management/commands/generate_static_content.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/djangoldp/management/commands/generate_static_content.py b/djangoldp/management/commands/generate_static_content.py index 33ddd49..bd6040a 100644 --- a/djangoldp/management/commands/generate_static_content.py +++ b/djangoldp/management/commands/generate_static_content.py @@ -62,7 +62,7 @@ class StaticContentGenerator: file_path += '.jsonld' os.makedirs(os.path.dirname(file_path), exist_ok=True) try: - with open(file_path, 'w') as f: + with open(file_path, 'w', encoding='utf-8') as f: f.write(content) self.stdout.write(self.style.SUCCESS(f'Successfully saved content for {model._meta.model_name} from {url} to {file_path}')) except IOError as e: @@ -113,7 +113,6 @@ class StaticContentGenerator: self._fetch_and_save_associated_content(original_id, path, depth) - def _rewrite_ids_before_saving(self, data): if isinstance(data, dict): if '@id' in data: @@ -154,7 +153,7 @@ class StaticContentGenerator: updated_content = json.loads(self._update_ids_and_fetch_associated(response.text, depth + 1)) updated_content = self._rewrite_ids_before_saving(updated_content) - with open(file_path, 'w') as f: + with open(file_path, 'w', encoding='utf-8') as f: f.write(json.dumps(updated_content)) self.regenerated_urls.add(url) self.stdout.write(self.style.SUCCESS(f'Successfully fetched and saved associated content from {url} to {file_path}')) -- GitLab