@@ -96,26 +96,25 @@ def query_licence(
96
96
cads_catalogue .database .Licence .portal ,
97
97
)
98
98
query = query .filter (cads_catalogue .database .Licence .licence_uid == licence_uid )
99
- try :
100
- results = (
101
- query .group_by (
102
- cads_catalogue .database .Licence .licence_uid ,
103
- cads_catalogue .database .Licence .title ,
104
- cads_catalogue .database .Licence .md_filename ,
105
- cads_catalogue .database .Licence .download_filename ,
106
- cads_catalogue .database .Licence .revision ,
107
- cads_catalogue .database .Licence .scope ,
108
- cads_catalogue .database .Licence .portal ,
109
- )
110
- .order_by (sa .desc ("revision" ))
111
- .first ()
99
+ result = (
100
+ query .group_by (
101
+ cads_catalogue .database .Licence .licence_uid ,
102
+ cads_catalogue .database .Licence .title ,
103
+ cads_catalogue .database .Licence .md_filename ,
104
+ cads_catalogue .database .Licence .download_filename ,
105
+ cads_catalogue .database .Licence .revision ,
106
+ cads_catalogue .database .Licence .scope ,
107
+ cads_catalogue .database .Licence .portal ,
112
108
)
113
- except sa .exc .NoResultFound as exc :
109
+ .order_by (sa .desc ("revision" ))
110
+ .first ()
111
+ )
112
+ if not result :
114
113
raise fastapi .HTTPException (
115
114
status_code = fastapi .status .HTTP_404_NOT_FOUND ,
116
115
detail = f"licence { licence_uid } not found" ,
117
- ) from exc
118
- return results # type: ignore
116
+ )
117
+ return result # type: ignore
119
118
120
119
121
120
def query_keywords (
0 commit comments