aboutsummaryrefslogtreecommitdiffstats
path: root/local/utility.py
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2014-05-11 15:15:43 +0300
committerkongr45gpen <electrovesta@gmail.com>2014-05-11 15:15:43 +0300
commitb566a6c3008af7b2549431cfe08c571c1d9cf8e5 (patch)
tree5b2108a571e969f0690d82fba0b4f1d9c8310ddc /local/utility.py
parent7a959464a488e539a442bdbcefb9daa5684f44ac (diff)
downloadsupybot_github-b566a6c3008af7b2549431cfe08c571c1d9cf8e5.tar.gz
supybot_github-b566a6c3008af7b2549431cfe08c571c1d9cf8e5.tar.bz2
supybot_github-b566a6c3008af7b2549431cfe08c571c1d9cf8e5.zip
Add showSuccessfulBuildMessages configuration variable
Diffstat (limited to 'local/utility.py')
-rw-r--r--local/utility.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/local/utility.py b/local/utility.py
index 1c478c3..dbdb69a 100644
--- a/local/utility.py
+++ b/local/utility.py
@@ -87,6 +87,34 @@ def clean(string):
regex = re.compile("(([\x02\x1f\x16\x0f])|(\x03(?:\d{1,2}(?:,\d{1,2})?)?))", re.UNICODE)
return regex.sub('', string)
+def isYes(string):
+ """Returns True if the string represents a yes, False, if it represents
+ no, and another string if it represents something else"""
+ value = string.strip().lower()
+
+ if value in ['yes', 'always', 'on', 'true']:
+ return True
+ if value in ['no', 'never', 'off', 'false', 'null']:
+ return False
+ if value in ['changed', 'change', 'on_change', 'diff']:
+ return 'change'
+
+def isStatusVisible(repo, status):
+ """Returns whether the build status message should be shown"""
+ config = isYes(configValue('showSuccessfulBuildMessages'))
+
+ changed = False
+ if status != "passed":
+ changed = True
+ elif type(config) is bool:
+ changed = config
+ elif repo not in globals.travisStatuses or status != globals.travisStatuses[repo]:
+ # Config is 'on_change'
+ changed = True
+
+ globals.travisStatuses[repo] = status
+ return changed
+
# Possible colours:
# white, black, (light/dark) blue, (light) green, red, brown, purple,
# orange, yellow, teal, pink, light/dark gray/grey

© 2014-2024 Faster IT GmbH | imprint | privacy policy