Esempio n. 1
0
    def __init__(self, alert_expiry=1, alert_limit=100, **kwargs):
        """Return a new UserPolicy object.

           Arguments:

           alert_expiry -- The delay after a successful alert after which
                           the limit no longer applies.
           alert_limit  -- The number of alerts allowed.
        """

        self.alert_expiry = alert_expiry
        self.alert_limit = alert_limit

        self._user = {}
        for k, v in kwargs.iteritems():
            if k not in self.allowed_attrs:
                raise UnknownAttribute(attribute=k)
            self._user[k] = v

        if 'username' not in self._user:
            raise MissingAttribute(attribute=username)