Skip to content

Commit

Permalink
Fixes error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
richmahn committed Sep 7, 2023
1 parent e35f192 commit c352098
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion converters/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def download_relation_repo(self, repo, ref):
# TODO: This is unsafe if the zipfile comes from an untrusted source
unzip(relation_filepath, self.download_dir)
finally:
AppSettings.logger.debug("Unzipping finished.")
AppSettings.logger.debug(f"Unzipping finished. Unzipped {relation_filepath} to {self.download_dir}")

# clean up the downloaded zip file
if os.path.isfile(relation_filepath):
Expand Down
6 changes: 2 additions & 4 deletions converters/pdf/pdf_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,7 @@ def get_catalog_entry(self, resource_name, owners, langs, refs):
try:
return AppSettings.catalog_api.catalog_get_entry(owner, repo, ref)
except ApiException as e:
AppSettings.logger.critical(
"Exception when calling V5Api->catalog_get_entry: %s\n" % e)
AppSettings.logger.critical(f"Exception when calling catalog_api->catalog_get_entry [{owner}, {repo}, {ref}]: {e}\n")

def process_relation_resources(self):
for relation in self.main_resource.relation:
Expand Down Expand Up @@ -1446,8 +1445,7 @@ def process_relation_resource(self, relation):
if entries and len(entries.data):
entry = entries.data[0]
except ApiException as e:
AppSettings.logger.critical(
"Exception when calling V5Api->catalog_search: %s\n" % e)
AppSettings.logger.critical(f"Exception when calling catalog_api->catalog_search [{repo_name}]: {e}\n")
if not entry:
return
resource = Resource(subject=entry.subject, owner=entry.owner, repo_name=entry.name,
Expand Down
7 changes: 4 additions & 3 deletions converters/pdf/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def logo_file(self):
def last_commit(self):
if not self._last_commit:
try:
commits = AppSettings.repo_api.repo_get_all_commits(self.owner, self.repo_name, sha=self.ref, limit=1)
commits = AppSettings.repo_api.repo_get_all_commits(self.owner, self.repo_name, sha=self.ref, limit=1)
if commits and len(commits) > 0:
self._last_commit = commits[0]
except ApiException as e:
AppSettings.logger.critical("Exception when calling RepositoryApi->repo_get_all_commits: %s\n" % e)
AppSettings.logger.critical(f"Exception when calling RepositoryApi->repo_get_all_commits [{self.owner}, {self.repo_name}, {self.ref}]: {e}\n")
return self._last_commit

@property
Expand Down Expand Up @@ -206,7 +206,8 @@ def catalog_entry(self):
try:
self._catalog_entry = AppSettings.catalog_api.catalog_get_entry(self.owner, self.repo_name, self.ref)
except ApiException as e:
print("Exception when calling V5Api->catalog_get_entry: %s\n" % e)
AppSettings.logger.critical(f"Exception when calling catalog_api->catalog_get_entry [{self.owner}, {self.repo_name}, {self.ref}]: {e}\n")

return self._catalog_entry


Expand Down
6 changes: 3 additions & 3 deletions converters/pdf/tn_pdf_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_body_html(self):
self.populate_tn_book_data()
html = self.get_tn_html()
return html

def determine_ult_bible(self):
ult_bible = None
for resource in self.resources.values():
Expand Down Expand Up @@ -101,8 +101,8 @@ def populate_tn_book_data(self):
tsv_filepath = os.path.join(self.main_resource.repo_dir, tsv_filepath)
if not os.path.isfile(tsv_filepath):
return
self.add_gl_quotes_to_tsv(tsv_filepath)
tsv_filepath += ".new"
self.add_gl_quotes_to_tsv(tsv_filepath)
tsv_filepath += ".new"
book_data = OrderedDict()
reader = self.unicode_csv_reader(open(tsv_filepath))
header = next(reader)
Expand Down

0 comments on commit c352098

Please sign in to comment.