From 79ff2842fa477ee0693ea167c0a74cd7cf080d27 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 31 Oct 2017 10:34:41 +0000 Subject: Import py-macaroon-bakery_0.0.3.orig.tar.gz --- macaroonbakery/checkers.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 macaroonbakery/checkers.py (limited to 'macaroonbakery/checkers.py') diff --git a/macaroonbakery/checkers.py b/macaroonbakery/checkers.py new file mode 100644 index 0000000..8d72eb9 --- /dev/null +++ b/macaroonbakery/checkers.py @@ -0,0 +1,23 @@ +# Copyright 2017 Canonical Ltd. +# Licensed under the LGPLv3, see LICENCE file for details. + +import collections + +_Caveat = collections.namedtuple('Caveat', 'condition location namespace') + + +class Caveat(_Caveat): + '''Represents a condition that must be true for a check to complete + successfully. + + If location is provided, the caveat must be discharged by + a third party at the given location (a URL string). + + The namespace parameter holds the namespace URI string of the + condition - if it is provided, it will be converted to a namespace prefix + before adding to the macaroon. + ''' + __slots__ = () + + def __new__(cls, condition, location=None, namespace=None): + return super(Caveat, cls).__new__(cls, condition, location, namespace) -- cgit v1.2.3