diff options
author | John Helmert III <ajak@gentoo.org> | 2023-12-25 14:50:45 -0800 |
---|---|---|
committer | John Helmert III <ajak@gentoo.org> | 2023-12-25 14:50:45 -0800 |
commit | 9a25184f2edfa9f7a269644b4d3bde265662cb9b (patch) | |
tree | 3ac210673a764e312630a71f648171997c88005e | |
parent | models/glsa: convert self.affected to list to fix typing (diff) | |
download | glsamaker-9a25184f2edfa9f7a269644b4d3bde265662cb9b.tar.gz glsamaker-9a25184f2edfa9f7a269644b4d3bde265662cb9b.tar.bz2 glsamaker-9a25184f2edfa9f7a269644b4d3bde265662cb9b.zip |
autoglsa: previous_glsa(): avoid returning None for typing
Signed-off-by: John Helmert III <ajak@gentoo.org>
-rw-r--r-- | glsamaker/autoglsa.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/glsamaker/autoglsa.py b/glsamaker/autoglsa.py index faac903..82de370 100644 --- a/glsamaker/autoglsa.py +++ b/glsamaker/autoglsa.py @@ -218,13 +218,19 @@ def previous_glsa(pkg: str) -> GLSA: # If there's none, we've probably never GLSA'd that package before if len(affected) == 0: raise FirstGlsaException - return ( + + last_glsa = ( db.session.query(GLSA) .filter(GLSA.affected.contains(affected[-1])) .order_by(GLSA.id.desc()) .first() ) + if last_glsa is None: + raise FirstGlsaException + + return last_glsa + def generate_resolution(glsa: GLSA, proper_name: str) -> str: resolution = "" |