Skip to content

Commit

Permalink
Fix username and subreddit display in failed extract messages
Browse files Browse the repository at this point in the history
  • Loading branch information
MalloyDelacroix committed Jul 23, 2018
1 parent d6c5de7 commit 4a321df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions DownloaderForReddit/Extractors/BaseExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def handle_failed_extract(self, message=None, save=False, **kwargs):
encountered.
"""
message_text = ': %s' % message if message else ''
failed_post = Post(self.url, self.user, self.post_title, self.subreddit, self.creation_date,
failed_post = Post(self.url, self.user.name, self.post_title, self.subreddit.display_name, self.creation_date,
status=message if message_text else 'Failed')
extra = {'extractor_data': self.get_log_data()}
if save and self.settings_manager.save_failed_extracts:
Expand All @@ -198,16 +198,16 @@ def save_failed_extract(self):
Saves a failed extract as a Post object to be retried upon future runs. This should only be done for certain
errors, such as an over capacity error, that are very likely to not be encountered again on future runs.
"""
self.failed_extracts_to_save.append(Post(self.url, self.user, self.post_title, self.subreddit,
self.failed_extracts_to_save.append(Post(self.url, self.user.name, self.post_title, self.subreddit.display_name,
self.creation_date))

def get_log_data(self):
"""
Returns a loggable dictionary of the extractors current variables to be put into the log.
"""
return {'url': self.url,
'user': self.user,
'subreddit': self.subreddit,
'user': self.user.name,
'subreddit': self.subreddit.display_name,
'post_title': self.post_title,
'creation_date': self.creation_date,
'save_path': self.save_path,
Expand Down

0 comments on commit 4a321df

Please sign in to comment.