diff --git a/spaceweather_processing/app.py b/spaceweather_processing/app.py
index 8c956adf5a0c783d7d0532371447e8b0832e9a36..f5b09e64318d7d794a1b6e205f212d884915ea83 100644
--- a/spaceweather_processing/app.py
+++ b/spaceweather_processing/app.py
@@ -136,7 +136,7 @@ class DataProductDB:
 
         # if a &sort=<field> url parameter is given then use sort, otherwise omit it (backward compatibility)
         if sort:
-            if sort[0]=='-':
+            if sort.startswith('-'):
                 direction = -1
                 sort = sort[1:]
             else: