-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from MatthiasValvekens/feature/better-error-st…
…ale-revinfo More precise error on stale revocation info
- Loading branch information
Showing
9 changed files
with
256 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from dataclasses import dataclass, field | ||
from datetime import datetime | ||
from typing import Any, Optional | ||
|
||
|
||
@dataclass | ||
class Errors: | ||
failures: list = field(default_factory=list) | ||
freshness_failures_only: bool = True | ||
stale_last_usable_at: Optional[datetime] = None | ||
|
||
def append(self, msg: str, revinfo: Any, is_freshness_failure=False): | ||
self.failures.append((msg, revinfo)) | ||
self.freshness_failures_only &= is_freshness_failure | ||
|
||
def update_stale(self, dt: Optional[datetime]): | ||
if dt is not None: | ||
self.stale_last_usable_at = ( | ||
dt | ||
if self.stale_last_usable_at is None | ||
else max(self.stale_last_usable_at, dt) | ||
) |
Oops, something went wrong.