View Single Post
Old 08-14-2025, 03:39 AM   #6
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 293
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
Good points, thank you! Yes, it's probably better to check that len(components) is exactly 4, as more than 4 would also be a problem. (I initially posted the fixed code checking against 3, then noticed my error and edited my above post.)

In fact I could probably be doing a lot more validation here, like adding a whitelist for known awards or to make sure that the rank field looks right (i.e., is a known word or a positive integer). Since this template is for transforming metadata on the fly while loading books onto my device, I will probably repurpose that added validation elsewhere as well, e.g. to show me a warning icon in my library view for books which fail.

Thanks again for the debugging help! <3

Last edited by isarl; 08-14-2025 at 03:40 AM. Reason: oops, no markdown here!
isarl is offline   Reply With Quote