Skip to content
Browse files

Use the provided Config's output stream if setOutputStream is never c…

…alled.
  • Loading branch information...
1 parent d9a22cd commit 8f30747dbf4f804c15cadbf6a0fbc6f6b9bc7a79 @exogen committed Mar 6, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 noseachievements/plugin.py
View
6 noseachievements/plugin.py
@@ -37,6 +37,7 @@ def __init__(self, achievements=default_manager, data=None):
achievements = AchievementManager(achievements)
self.achievements = achievements
self.data = AchievementData(data or {})
+ self.output_stream = None
def options(self, parser, env):
if Plugin is not object:
@@ -55,6 +56,9 @@ def options(self, parser, env):
"groups. [ACHIEVEMENTS]")
def configure(self, options, conf):
+ # Save a reference to the `Config` to access its `stream` in case
+ # setOutputStream isn't called.
+ self.config = conf
if Plugin is not object:
super(AchievementsPlugin, self).configure(options, conf)
@@ -138,7 +142,7 @@ def finalize(self, result):
self.data.save(data_file)
data_file.close()
- output_stream = self.output_stream
+ output_stream = self.output_stream or self.config.stream
if str is not unicode:
output_stream = codecs.getwriter('utf-8')(output_stream)
for achievement in self.data['achievements.new']:

0 comments on commit 8f30747

Please sign in to comment.
Something went wrong with that request. Please try again.