check for latitude and longitude before accessing them
This commit is contained in:
parent
e735aec296
commit
856e6f4242
1 changed files with 17 additions and 13 deletions
|
@ -263,6 +263,8 @@ def has_place(note):
|
||||||
def get_place(note):
|
def get_place(note):
|
||||||
if note.get("location") and note["location"].get("type") == "Place":
|
if note.get("location") and note["location"].get("type") == "Place":
|
||||||
tag = note["location"]
|
tag = note["location"]
|
||||||
|
|
||||||
|
if tag.get("latitude") and tag.get("longitude"):
|
||||||
lat = tag["latitude"]
|
lat = tag["latitude"]
|
||||||
lng = tag["longitude"]
|
lng = tag["longitude"]
|
||||||
out = ""
|
out = ""
|
||||||
|
@ -281,6 +283,8 @@ def get_place(note):
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@filters.app_template_filter()
|
@filters.app_template_filter()
|
||||||
def poll_answer_key(choice: str) -> str:
|
def poll_answer_key(choice: str) -> str:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue