Skip to content

Commit

Permalink
Change meaning of 'enableable' and 'disableable'
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Mar 4, 2016
1 parent d1977c9 commit 1f511bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions usagestats.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def enabled(self):

@property
def enableable(self):
return self.status is not Stats.ERRORED
return self.status not in (Stats.ERRORED, Stats.ENABLED)

@property
def disableable(self):
return self.status is not Stats.ERRORED
return self.status not in (Stats.ERRORED, Stats.DISABLED)

@property
def recording(self):
Expand Down Expand Up @@ -234,6 +234,8 @@ def enable_reporting(self):
and the configuration will be updated so that future runs also upload
automatically.
"""
if self.status == Stats.ENABLED:
return
if not self.enableable:
logger.critical("Can't enable reporting")
return
Expand All @@ -247,6 +249,8 @@ def disable_reporting(self):
recorded ones that haven't been uploaded. The configuration is updated
so that future runs do not record or upload reports.
"""
if self.status == Stats.DISABLED:
return
if not self.disableable:
logger.critical("Can't disable reporting")
return
Expand Down

0 comments on commit 1f511bb

Please sign in to comment.