summaryrefslogtreecommitdiff
path: root/macaroonbakery/checkers/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'macaroonbakery/checkers/utils.py')
-rw-r--r--macaroonbakery/checkers/utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/macaroonbakery/checkers/utils.py b/macaroonbakery/checkers/utils.py
new file mode 100644
index 0000000..f2e51b1
--- /dev/null
+++ b/macaroonbakery/checkers/utils.py
@@ -0,0 +1,13 @@
+# Copyright 2017 Canonical Ltd.
+# Licensed under the LGPLv3, see LICENCE file for details.
+
+
+def condition_with_prefix(prefix, condition):
+ '''Returns the given string prefixed by the given prefix.
+
+ If the prefix is non-empty, a colon is used to separate them.
+ '''
+ if prefix == '':
+ return condition
+
+ return prefix + ':' + condition