diff --git a/providers/callsigndata/hamqth.py b/providers/callsigndata/hamqth.py index bfe567e..5103b86 100644 --- a/providers/callsigndata/hamqth.py +++ b/providers/callsigndata/hamqth.py @@ -124,8 +124,8 @@ class HamQTH(APIQueryCallsignDataProvider): lat = None lon = None if ( - "latitude" in data - and "longitude" in data + data.get("latitude") is not None + and data.get("longitude") is not None and (float(data["latitude"]) != 0 or float(data["longitude"]) != 0) and -89.9 < float(data["latitude"]) < 89.9 ): @@ -134,7 +134,7 @@ class HamQTH(APIQueryCallsignDataProvider): # Check for sensible grids grid = None - if "grid" in data and not data["grid"].startswith("AA00"): + if data.get("grid") and not data["grid"].startswith("AA00"): grid = data["grid"] return Callsign( @@ -147,8 +147,8 @@ class HamQTH(APIQueryCallsignDataProvider): latitude=lat, longitude=lon, grid=grid, - dxcc_id=int(data["adif"]) if "adif" in data else None, - cq_zone=int(data["cq"]) if "cq" in data else None, - itu_zone=int(data["itu"]) if "itu" in data else None, + dxcc_id=int(data["adif"]) if data.get("adif") is not None else None, + cq_zone=int(data["cq"]) if data.get("cq") is not None else None, + itu_zone=int(data["itu"]) if data.get("itu") is not None else None, location_source=LocationSourceForCallsign.HOME_QTH, ) diff --git a/providers/callsigndata/qrz.py b/providers/callsigndata/qrz.py index 4ed570c..a6a8cdb 100644 --- a/providers/callsigndata/qrz.py +++ b/providers/callsigndata/qrz.py @@ -150,8 +150,8 @@ class QRZ(APIQueryCallsignDataProvider): lat = None lon = None if ( - "latitude" in data - and "longitude" in data + data.get("latitude") is not None + and data.get("longitude") is not None and (float(data["latitude"]) != 0 or float(data["longitude"]) != 0) and -89.9 < float(data["latitude"]) < 89.9 ): @@ -160,7 +160,7 @@ class QRZ(APIQueryCallsignDataProvider): # Check for sensible grids grid = None - if "grid" in data and not data["grid"].startswith("AA00"): + if data.get("grid") and not data["grid"].startswith("AA00"): grid = data["grid"] return Callsign( @@ -173,8 +173,8 @@ class QRZ(APIQueryCallsignDataProvider): latitude=lat, longitude=lon, grid=grid, - dxcc_id=int(data["adif"]) if "adif" in data else None, - cq_zone=int(data["cqzone"]) if "cqzone" in data else None, - itu_zone=int(data["ituzone"]) if "ituzone" in data else None, + dxcc_id=int(data["adif"]) if data.get("adif") is not None else None, + cq_zone=int(data["cqzone"]) if data.get("cqzone") is not None else None, + itu_zone=int(data["ituzone"]) if data.get("ituzone") is not None else None, location_source=LocationSourceForCallsign.HOME_QTH, ) diff --git a/providers/spot/aprsis.py b/providers/spot/aprsis.py index 3977a60..cc4be2a 100644 --- a/providers/spot/aprsis.py +++ b/providers/spot/aprsis.py @@ -69,8 +69,8 @@ class APRSIS(SpotProvider): de_call=de_call, de_ssid=de_ssid, comment=str(data["comment"]) if "comment" in data else None, - dx_latitude=float(data["latitude"]) if "latitude" in data else None, - dx_longitude=float(data["longitude"]) if "longitude" in data else None, + dx_latitude=float(data["latitude"]) if data.get("latitude") is not None else None, + dx_longitude=float(data["longitude"]) if data.get("longitude") is not None else None, time=datetime.now(pytz.UTC).timestamp(), ) # APRS-IS spots are live so we can assume spot time is "now" diff --git a/providers/spot/ukpacketnet.py b/providers/spot/ukpacketnet.py index 05d28c1..3516d21 100644 --- a/providers/spot/ukpacketnet.py +++ b/providers/spot/ukpacketnet.py @@ -42,7 +42,7 @@ class UKPacketNet(HTTPSpotProvider): ) comment = ( f"{comment} {listed_port['baud']!s} baud" - if "baud" in listed_port and listed_port["baud"] > 0 + if listed_port.get("baud") and listed_port["baud"] > 0 else comment ) @@ -50,7 +50,7 @@ class UKPacketNet(HTTPSpotProvider): # very hacky but a lot of node comments contain their frequency as the first or second # word of their comment, but not in the proper data structure field. freq = ( - listed_port["freq"] if "freq" in listed_port and listed_port["freq"] > 0 else None + listed_port["freq"] if listed_port.get("freq") and listed_port["freq"] > 0 else None ) if not freq and comment: possible_freq = comment.split(" ")[0].upper().replace("MHZ", "") diff --git a/providers/spot/wwbota.py b/providers/spot/wwbota.py index 3525312..cea64b9 100644 --- a/providers/spot/wwbota.py +++ b/providers/spot/wwbota.py @@ -36,7 +36,7 @@ class WWBOTA(SSESpotProvider): dx_call=source_spot["call"].upper(), de_call=source_spot["spotter"].upper(), freq=float(source_spot["freq"]) * 1000000, - mode=Mode.from_name(source_spot["mode"].upper()) if "mode" in source_spot else None, + mode=Mode.from_name(source_spot["mode"].upper()) if source_spot.get("mode") else None, comment=source_spot["comment"], sig="WWBOTA", sig_refs=refs, diff --git a/templates/add_spot.html b/templates/add_spot.html index 0a182db..5eb2e5a 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -77,7 +77,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index b6dc4d8..8af212b 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -83,7 +83,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index cf1ab35..9266406 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,8 +76,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 61b7f49..0061012 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -16,10 +16,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index e19356e..14c0a87 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index 494222b..bb5d920 100644 --- a/templates/map.html +++ b/templates/map.html @@ -113,8 +113,8 @@ const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}"; - - + + diff --git a/templates/spots.html b/templates/spots.html index 4c781e7..2069376 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -125,8 +125,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index 5f0d879..07788c2 100644 --- a/templates/status.html +++ b/templates/status.html @@ -96,7 +96,7 @@ - +